Development

David Carr

Laravel Telescope error when running tests ReflectionException: Class env does not exist

Today I came across an error in a Laravel application that runs Telescope that when I run PHPUnit I was getting this error:

1) Tests\Unit\ExampleTest::testBasicTest
ReflectionException: Class env does not exist

The solution to fix this is to open phpunit.xml and add the below line in the php section.

<env name="TELESCOPE_ENABLED" value="false"/>

This disables Telescope and allows your test suite to run.

Remember to clear the cache afterwards:

php artisan clear
php artisan config:clear

 

Support my work by donating with PayPal.

Subscribe to my newsletter

Subscribe and get my books and product announcements.

© 2009 - 2020 DC Blog. All code MIT license. All rights reserved.