The problem:
Run your tests with:
- old way:
vendor/bin/phpunit
- new way:
php artisan test
- Or using the PHPStorm UI.
Then in console throws this error:
ReflectionException: Class env does not exist
Below it says that something in test environment fails with Telescope, I didnt change any code base or environment so... this problem is always related with cache:
Solution
- Step 1
Disable telescope for tests on your PHPUnit.xml add:
<env name="TELESCOPE_ENABLED" value="false"/>
- Step 2
Then go to the terminal and execute:
php artisan clear
php artisan config:clear
Note
I get the solution from two sites:
This github issue
And from the David Carr blog
I only facilitate the information in this platform because I had a few hours searching for a solution and with a descriptive title it would be easy to search for anyone in the future.
Thanks for reading!
Top comments (2)
I solved. Thanks Ariel:)
You are welcome!