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

Function testRequestSuperGlobal

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

Source from the content-addressed store, hash-verified

333 testRequestSuperGlobal(t, &testOptions{workerScript: "request-superglobal.php", phpIni: phpIni})
334}
335func testRequestSuperGlobal(t *testing.T, opts *testOptions) {
336 runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {
337 // Test with both GET and POST parameters
338 // $_REQUEST should contain merged data from both
339 formData := url.Values{"post_key": {fmt.Sprintf("post_value_%d", i)}}
340 req := httptest.NewRequest("POST", fmt.Sprintf("http://example.com/request-superglobal.php?get_key=get_value_%d", i), strings.NewReader(formData.Encode()))
341 req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
342 body, _ := testRequest(req, handler, t)
343
344 // Verify $_REQUEST contains both GET and POST data for the current request
345 assert.Contains(t, body, fmt.Sprintf("'get_key' => 'get_value_%d'", i))
346 assert.Contains(t, body, fmt.Sprintf("'post_key' => 'post_value_%d'", i))
347 }, opts)
348}
349
350func TestRequestSuperGlobalConditional_worker(t *testing.T) {
351 // This test verifies that $_REQUEST works correctly when accessed conditionally

Callers 2

Calls 3

runTestFunction · 0.85
testRequestFunction · 0.85
SetMethod · 0.80

Tested by

no test coverage detected