(t *testing.T, opts *testOptions)
| 416 | testSession(t, &testOptions{workerScript: "session.php"}) |
| 417 | } |
| 418 | func 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 | |
| 444 | func TestPhpInfo_module(t *testing.T) { testPhpInfo(t, nil) } |
| 445 | func TestPhpInfo_worker(t *testing.T) { testPhpInfo(t, &testOptions{workerScript: "phpinfo.php"}) } |
no test coverage detected