本地预览:测试断言同步到已启用的 OPcache 配置

deploy/php-local.ini 已改为 OPcache 开启 + 每次请求校验时间戳,测试仍断言 opcache.enable=0 导致失败;更新为 enable=1 并校验时间戳。
This commit is contained in:
yueyang 2026-10-12 17:12:00 +08:00
parent a90736592a
commit 26f945ba29

View File

@ -62,14 +62,17 @@ class WebProcessOwnershipTest extends TestCase
$this->assertStringContainsString('run_artisan_as_web view:cache', $entrypoint);
}
public function test_local_php_and_view_caches_are_disabled(): void
public function test_local_php_cache_follows_bind_mounted_source(): void
{
$php = file_get_contents(base_path('deploy/php-local.ini'));
$view = file_get_contents(base_path('config/view.php'));
$this->assertIsString($php);
$this->assertStringContainsString('opcache.enable=0', $php);
// OPcache 开启以加速本地预览,但每次请求校验时间戳:源码一改、下次请求立即生效。
$this->assertStringContainsString('opcache.enable=1', $php);
$this->assertStringContainsString('opcache.enable_cli=0', $php);
$this->assertStringContainsString('opcache.validate_timestamps=1', $php);
$this->assertStringContainsString('opcache.revalidate_freq=0', $php);
$this->assertStringContainsString("'cache' => env('APP_ENV', 'production') === 'local'", $view);
$this->assertStringContainsString("? false", $view);
}