Using environment variables in Laravel tests

Tutorials

November 16th, 2015

Matt Stauffer has a new quick tutorial on how to implement an .env.test file for your Laravel tests.

He starts out discussing ways of setting them through the phpunit.xml file but those would then be committed to the repo which isn’t ideal. With help he came up with the idea to utilize DotEnv and include the .env file from tests/TestCase.php.

Go read the full tutorial for all the details.

Filed in:

Eric L. Barnes

Eric is the creator of Laravel News and has been covering Laravel since 2012.