Laravel 6 在 phpunit.xml 中包含一些额外的配置:
<server name="APP_CONFIG_CACHE" value="bootstrap/cache/config.phpunit.php"/>
<server name="APP_SERVICES_CACHE" value="bootstrap/cache/services.phpunit.php"/>
<server name="APP_PACKAGES_CACHE" value="bootstrap/cache/packages.phpunit.php"/>
<server name="APP_ROUTES_CACHE" value="bootstrap/cache/routes.phpunit.php"/>
<server name="APP_EVENTS_CACHE" value="bootstrap/cache/events.phpunit.php"/>
如果我在 PHPStorm 中运行测试,我会收到以下错误:
在 PackageManifest.php 第 168 行:
bootstrap/cache 目录必须存在且可写。
但是 bootstrap/cache 目录确实存在并且可写。但是,如果我在 phpunit.xml 中注释掉那些新配置,我的测试就会运行而不会出现任何错误。我该如何解决?
我也跑了php artisan cache:clear
。没运气。