Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matt Stauffer:
Environment specific variables in Laravel's testing environment
Nov 06, 2015 @ 16:43:09

Matt Stauffer has a quick post to his site showing how you can set up and use environment specific variables in Laravel, specifically for your testing environment.

In Laravel, it's easy to set environment variables that are specific to your testing environment. Just edit your phpunit.xml file and set them as entries in the block [...] but what if you find yourself needing to exclude these values from version control?

He talks about the project he's working on and its integration with Twilio. He need to write some tests for a class that connected to the Twilio service but wanted an easy way to swap out the production credentials with the Twilio test ones. Instead of checking in the test credentials, he dropped them into his .env settings file, one specific to the test environment.

tagged: environment variable laravel testing twilio credentials.

Link: https://mattstauffer.co/blog/environment-specific-variables-in-laravels-testing-environment


Trending Topics: