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

David Carr

1 min read - 23rd Sep, 2019

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

 

0 comments
Add a comment

Copyright © 2006 - 2024 DC Blog - All rights reserved.