MCPcopy Index your code
hub / github.com/php/frankenphp / testLog_frankenphp_log

Function testLog_frankenphp_log

frankenphp_test.go:509–529  ·  view source on GitHub ↗
(t *testing.T, opts *testOptions)

Source from the content-addressed store, hash-verified

507 testLog_frankenphp_log(t, &testOptions{workerScript: "log-frankenphp_log.php"})
508}
509func testLog_frankenphp_log(t *testing.T, opts *testOptions) {
510 var buf fmt.Stringer
511 opts.logger, buf = newTestLogger(t)
512
513 runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {
514 req := httptest.NewRequest("GET", fmt.Sprintf("http://example.com/log-frankenphp_log.php?i=%d", i), nil)
515 w := httptest.NewRecorder()
516 handler(w, req)
517
518 logs := buf.String()
519 for _, message := range []string{
520 `level=INFO msg="default level message"`,
521 fmt.Sprintf(`level=DEBUG msg="some debug message %d" "key int"=1`, i),
522 fmt.Sprintf(`level=INFO msg="some info message %d" "key string"=string`, i),
523 fmt.Sprintf(`level=WARN msg="some warn message %d"`, i),
524 fmt.Sprintf(`level=ERROR msg="some error message %d" err="[a v]"`, i),
525 } {
526 assert.Contains(t, logs, message)
527 }
528 }, opts)
529}
530
531func TestConnectionAbort_module(t *testing.T) { testConnectionAbort(t, &testOptions{}) }
532func TestConnectionAbort_worker(t *testing.T) {

Callers 2

Calls 3

newTestLoggerFunction · 0.85
runTestFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected