From 26f945ba29e1100da9c5fcad8ecfdf1d4acb446b Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Mon, 12 Oct 2026 17:12:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E9=A2=84=E8=A7=88=EF=BC=9A?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=AD=E8=A8=80=E5=90=8C=E6=AD=A5=E5=88=B0?= =?UTF-8?q?=E5=B7=B2=E5=90=AF=E7=94=A8=E7=9A=84=20OPcache=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deploy/php-local.ini 已改为 OPcache 开启 + 每次请求校验时间戳,测试仍断言 opcache.enable=0 导致失败;更新为 enable=1 并校验时间戳。 --- tests/Unit/Deployment/WebProcessOwnershipTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Unit/Deployment/WebProcessOwnershipTest.php b/tests/Unit/Deployment/WebProcessOwnershipTest.php index 6d44d0ab..12130d05 100644 --- a/tests/Unit/Deployment/WebProcessOwnershipTest.php +++ b/tests/Unit/Deployment/WebProcessOwnershipTest.php @@ -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); }