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


Domains are often purchased from multiple providers, keeping track of where a domain is and its DNS settings can be tricky. Domain Mapper solves this by listing all your domains in one place. View your DNS settings and receive reminders to renew your domains. Try it today.

Support my work by donating with PayPal.

Subscribe to my newsletter

Subscribe and get my books and product announcements.

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