Skip to content

Commit 3ae7b15

Browse files
committed
Fixes test on -nowatcher
1 parent c64f43b commit 3ae7b15

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

frankenphp_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,3 +994,13 @@ func FuzzRequest(f *testing.F) {
994994
}, &testOptions{workerScript: "request-headers.php"})
995995
})
996996
}
997+
998+
func fetchBody(method string, url string, handler func(http.ResponseWriter, *http.Request)) string {
999+
req := httptest.NewRequest(method, url, nil)
1000+
w := httptest.NewRecorder()
1001+
handler(w, req)
1002+
resp := w.Result()
1003+
body, _ := io.ReadAll(resp.Body)
1004+
1005+
return string(body)
1006+
}

watcher_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@ func TestWorkersShouldNotReloadOnExcludingPattern(t *testing.T) {
4141
}, &testOptions{nbParallelRequests: 1, nbWorkers: 1, workerScript: "worker-with-watcher.php", watch: watch})
4242
}
4343

44-
func fetchBody(method string, url string, handler func(http.ResponseWriter, *http.Request)) string {
45-
req := httptest.NewRequest(method, url, nil)
46-
w := httptest.NewRecorder()
47-
handler(w, req)
48-
resp := w.Result()
49-
body, _ := io.ReadAll(resp.Body)
50-
51-
return string(body)
52-
}
53-
5444
func pollForWorkerReset(t *testing.T, handler func(http.ResponseWriter, *http.Request), limit int) bool {
5545
// first we make an initial request to start the request counter
5646
body := fetchBody("GET", "http://example.com/worker-with-watcher.php", handler)

0 commit comments

Comments
 (0)