(t *testing.T, opts *testOptions)
| 1322 | } |
| 1323 | |
| 1324 | func testOpcachePreload(t *testing.T, opts *testOptions) { |
| 1325 | if frankenphp.Version().VersionID <= 80300 { |
| 1326 | t.Skip("This test is only supported in PHP 8.3 and above") |
| 1327 | return |
| 1328 | } |
| 1329 | if runtime.GOOS == "windows" { |
| 1330 | t.Skip("opcache.preload is not supported on Windows") |
| 1331 | return |
| 1332 | } |
| 1333 | |
| 1334 | cwd, _ := os.Getwd() |
| 1335 | preloadScript := cwd + "/testdata/preload.php" |
| 1336 | |
| 1337 | u, err := user.Current() |
| 1338 | require.NoError(t, err) |
| 1339 | |
| 1340 | // use opcache.log_verbosity_level:4 for debugging |
| 1341 | opts.phpIni = map[string]string{ |
| 1342 | "opcache.enable": "1", |
| 1343 | "opcache.preload": preloadScript, |
| 1344 | "opcache.preload_user": u.Username, |
| 1345 | } |
| 1346 | |
| 1347 | runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { |
| 1348 | body, _ := testGet("http://example.com/preload-check.php", handler, t) |
| 1349 | assert.Equal(t, "I am preloaded", body) |
| 1350 | }, opts) |
| 1351 | } |
no test coverage detected