Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Adding test bootstrap.php file so .env vars are read #366
The problem is that currently, environment variables must be completely duplicated between
This is an easy win:
This works particularly well, because any env vars set in phpunit.xml.dist WIN over .env. This means that .env can contain default values, but can then be easily overridden for the test environment.
@weaverryan: That's already a great improvement, but this doesn't solve another linked issue that should also be considered to me: running a command in another env, including
If it can be of any help, here is what I'm using currently on flex projects: A DotEnvLoader class allows to load an extra
This is tough: we're getting WTF moments when someone tries to set, for example, APP_ENV=test or some other environment, and suddenly the .env file isn't loaded. This is to hopefully make things work in a more predictable way: .env is always loaded, except in the prod environment. This works because DotEnv does not override any existing variables, so there's no risk in loading it.
I've just made this PR more complicated :). I've change to load the
I think this is important: we continue to see users confused about why the
So the goal is simple: load the
Also, @ogizanagi brings up another point in his comment. There's not an easy way, for example, to set a different
So.... I think we need to make several changes to our
I guess the possibility to use
Probably this file also should be updated: https://github.com/symfony/recipes/blob/master/behat/symfony2-extension/2.1/features/bootstrap/bootstrap.php#L6