lundi 28 novembre 2016

Phpunit overriding variable in .env

In my .env file of a laravel 5.1 project i have set the APP_ENV to local, But when i run the test from the terminal the with

vendor/bin/phpunit

the debug and die on

dd(env(APP_ENV));

gives me "testing".

I Have dont a good research on this, tried using the following ways -

  • trying to set the APP_ENV=local pipelining vendor/bin/phpunit form the cli.
  • Trying to add env variable in the phpunit.xml file<env name="APP_ENV" value="local" override="true"> (dosent seem to override though)
  • adding a .env.testing file and setting the APP_ENV=local
  • in the testCase.php file where the application autoloads $app->loadEnvironmentFrom('.env.testing');

none of the above methods give me the expected result rather everytime i run the test give APP_ENV as "testing".

Not able to trace where is phpunit setting this variable from. Pls help out!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire