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

Function testPostSuperGlobals

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

Source from the content-addressed store, hash-verified

313 testPostSuperGlobals(t, &testOptions{workerScript: "super-globals.php"})
314}
315func testPostSuperGlobals(t *testing.T, opts *testOptions) {
316 runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {
317 formData := url.Values{"baz": {"bat"}, "i": {fmt.Sprintf("%d", i)}}
318 req := httptest.NewRequest("POST", fmt.Sprintf("http://example.com/super-globals.php?foo=bar&iG=%d", i), strings.NewReader(formData.Encode()))
319 req.Header.Set("Content-Type", strings.Clone("application/x-www-form-urlencoded"))
320 body, _ := testRequest(req, handler, t)
321
322 assert.Contains(t, body, "'foo' => 'bar'")
323 assert.Contains(t, body, fmt.Sprintf("'i' => '%d'", i))
324 assert.Contains(t, body, "'baz' => 'bat'")
325 assert.Contains(t, body, fmt.Sprintf("'iG' => '%d'", i))
326 }, opts)
327}
328
329func TestRequestSuperGlobal_module(t *testing.T) { testRequestSuperGlobal(t, nil) }
330func TestRequestSuperGlobal_worker(t *testing.T) {

Callers 2

Calls 3

runTestFunction · 0.85
testRequestFunction · 0.85
SetMethod · 0.80

Tested by

no test coverage detected