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

Function testSession

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

Source from the content-addressed store, hash-verified

416 testSession(t, &testOptions{workerScript: "session.php"})
417}
418func testSession(t *testing.T, opts *testOptions) {
419 if opts == nil {
420 opts = &testOptions{}
421 }
422 opts.realServer = true
423
424 runTest(t, func(_ func(http.ResponseWriter, *http.Request), ts *httptest.Server, i int) {
425 jar, err := cookiejar.New(&cookiejar.Options{})
426 assert.NoError(t, err)
427
428 client := &http.Client{Jar: jar}
429
430 resp1, err := client.Get(ts.URL + "/session.php")
431 assert.NoError(t, err)
432
433 body1, _ := io.ReadAll(resp1.Body)
434 assert.Equal(t, "Count: 0\n", string(body1))
435
436 resp2, err := client.Get(ts.URL + "/session.php")
437 assert.NoError(t, err)
438
439 body2, _ := io.ReadAll(resp2.Body)
440 assert.Equal(t, "Count: 1\n", string(body2))
441 }, opts)
442}
443
444func TestPhpInfo_module(t *testing.T) { testPhpInfo(t, nil) }
445func TestPhpInfo_worker(t *testing.T) { testPhpInfo(t, &testOptions{workerScript: "phpinfo.php"}) }

Callers 2

TestSession_moduleFunction · 0.85
TestSession_workerFunction · 0.85

Calls 2

runTestFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected