MCPcopy Create free account
hub / github.com/php/frankenphp / TestWorkerEnv

Function TestWorkerEnv

worker_test.go:82–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func TestWorkerEnv(t *testing.T) {
83 runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {
84 req := httptest.NewRequest("GET", fmt.Sprintf("http://example.com/worker-env.php?i=%d", i), nil)
85 w := httptest.NewRecorder()
86 handler(w, req)
87
88 resp := w.Result()
89 body, _ := io.ReadAll(resp.Body)
90
91 assert.Equal(t, fmt.Sprintf("bar%d", i), string(body))
92 }, &testOptions{workerScript: "worker-env.php", nbWorkers: 1, env: map[string]string{"FOO": "bar"}, nbParallelRequests: 10})
93}
94
95func TestWorkerGetOpt(t *testing.T) {
96 logger, buf := newTestLogger(t)

Callers

nothing calls this directly

Calls 2

runTestFunction · 0.85
ResultMethod · 0.80

Tested by

no test coverage detected