(t *testing.T)
| 93 | } |
| 94 | |
| 95 | func TestWorkerGetOpt(t *testing.T) { |
| 96 | logger, buf := newTestLogger(t) |
| 97 | |
| 98 | runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { |
| 99 | req := httptest.NewRequest("GET", fmt.Sprintf("http://example.com/worker-getopt.php?i=%d", i), nil) |
| 100 | req.Header.Add("Request", strconv.Itoa(i)) |
| 101 | w := httptest.NewRecorder() |
| 102 | |
| 103 | handler(w, req) |
| 104 | |
| 105 | resp := w.Result() |
| 106 | body, _ := io.ReadAll(resp.Body) |
| 107 | |
| 108 | assert.Contains(t, string(body), fmt.Sprintf("[HTTP_REQUEST] => %d", i)) |
| 109 | assert.Contains(t, string(body), fmt.Sprintf("[REQUEST_URI] => /worker-getopt.php?i=%d", i)) |
| 110 | }, &testOptions{logger: logger, workerScript: "worker-getopt.php", env: map[string]string{"FOO": "bar"}}) |
| 111 | |
| 112 | assert.NotRegexp(t, buf.String(), "exit_status=[1-9]") |
| 113 | } |
| 114 | |
| 115 | func ExampleServeHTTP_workers() { |
| 116 | if err := frankenphp.Init( |
nothing calls this directly
no test coverage detected