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

Function testRegisterExtension

internal/testext/exttest.go:25–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func testRegisterExtension(t *testing.T) {
26 frankenphp.RegisterExtension(unsafe.Pointer(&C.module1_entry))
27 frankenphp.RegisterExtension(unsafe.Pointer(&C.module2_entry))
28
29 err := frankenphp.Init()
30 require.Nil(t, err)
31 defer frankenphp.Shutdown()
32
33 req := httptest.NewRequest("GET", "http://example.com/index.php", nil)
34 w := httptest.NewRecorder()
35
36 req, err = frankenphp.NewRequestWithContext(req, frankenphp.WithRequestDocumentRoot("./testdata", false))
37 assert.NoError(t, err)
38
39 err = frankenphp.ServeHTTP(w, req)
40 assert.NoError(t, err)
41
42 resp := w.Result()
43 body, _ := io.ReadAll(resp.Body)
44 assert.Contains(t, string(body), "ext1")
45 assert.Contains(t, string(body), "ext2")
46}

Callers 1

TestRegisterExtensionFunction · 0.85

Calls 7

RegisterExtensionFunction · 0.92
InitFunction · 0.92
ShutdownFunction · 0.92
NewRequestWithContextFunction · 0.92
WithRequestDocumentRootFunction · 0.92
ServeHTTPFunction · 0.92
ResultMethod · 0.80

Tested by 1

TestRegisterExtensionFunction · 0.68