This problem occurs after I upgrade my Laravel from 8 to 9. At first running single test function in a feature test was not a problem. But then after I added a 2nd test function, when ever I tried to run "artisan test", I got the following error
PHPUnit\Framework\ExceptionWrapper
The "" directory does not exist.
at vendor/symfony/finder/Finder.php:590
This error did not happen when I run any other artisan command. Only when running "artisan test" and when I have multiple functions within a single feature test.
So what I have done so far:
local.ERROR: The "" directory does not exist. {"exception":"[object] (Symfony\\Component\\Finder\\Exception\\DirectoryNotFoundException(code: 0): The \"\" directory does not exist. at .../vendor/symfony/finder/Finder.php:592) [stacktrace] .../vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(86): Symfony\\Component\\Finder\\Finder->in('') .../vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(63): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->getConfigurationFiles(Object(Illuminate\\Foundation\\Application)) .../vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->loadConfigurationFiles(Object(Illuminate\\Foundation\\Application), Object(Illuminate\\Config\\Repository)) .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(242): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap(Object(Illuminate\\Foundation\\Application)) .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(383): Illuminate\\Foundation\\Application->bootstrapWith(Array)
...
This was exception trigger when running "artisan optimize" as well as "artisan test" (with multiple tests in a single file.
Turns out this error originated from my poor choice of variable name inside .env .
I used a variable name APP_BASE_PATH="public_html"
inside my .env file.
And boy that was a mistake that not only make artisan test
, but also artisan optimize
to be totally "disabled".
So after I change it to PUBLIC_DIR="public_shtml"
my artisan command works again.
I learn my lesson not to use any variable name inside .env without checking it first if it's used by core or any libraries that I used.
So I guess APP_BASE_PATH
is a reserved name in Laravel core ?