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

Function testCookies

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

Source from the content-addressed store, hash-verified

379func TestCookies_module(t *testing.T) { testCookies(t, nil) }
380func TestCookies_worker(t *testing.T) { testCookies(t, &testOptions{workerScript: "cookies.php"}) }
381func testCookies(t *testing.T, opts *testOptions) {
382 runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {
383 req := httptest.NewRequest("GET", "http://example.com/cookies.php", nil)
384 req.AddCookie(&http.Cookie{Name: "foo", Value: "bar"})
385 req.AddCookie(&http.Cookie{Name: "i", Value: fmt.Sprintf("%d", i)})
386 body, _ := testRequest(req, handler, t)
387
388 assert.Contains(t, body, "'foo' => 'bar'")
389 assert.Contains(t, body, fmt.Sprintf("'i' => '%d'", i))
390 }, opts)
391}
392
393func TestMalformedCookie(t *testing.T) {
394 runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {

Callers 2

TestCookies_moduleFunction · 0.85
TestCookies_workerFunction · 0.85

Calls 2

runTestFunction · 0.85
testRequestFunction · 0.85

Tested by

no test coverage detected