dimanche 5 février 2017

PHPunit ignoring Laravel's .env database config

I am building an API with Laravel 5.4 and writing integration tests using PHPunit, all within a Vagrant vm. The tests are working fine and is connecting to the database via credentials defined in .env.testing which is being called via line $app->loadEnvironmentFrom('.env.testing'); in tests/TestCase.php.

This is all fine, but when I try to run this on the staging server, PHPunit is not calling the environment file and therefore cannot run the tests. I have found that the tests work when populating the variables into phpunit.xml, however I don't like this approach because the values are hardcoded into this file.

Can anyone help me determine what may be different between these two environments for them to behave differently?

Aucun commentaire:

Enregistrer un commentaire