Search code examples
phplaravelunit-testinglaravel-5

Laravel: App::runningUnitTests() returns false while running unit tests


I am running unit tests on Laravel 5 and as the questions explains itself, App::runningUnitTests() is returning false during unit tests run. Why is that happening?

My phpunit.xml has this:

<env name="APP_ENV" value="testing"/>

My PHP version is 7.1.


Solution

  • As it turns out config cache was the issue. php artisan config:clear did the trick. Earlier, I was trying php artisan config:cache.