Open PatrickMessierGoC opened 7 months ago
Have you tried to load the env file in the volume?
@fabio-ivona No. In fact, the question here is not about getting the env files in the container but rather about why Pest behaves this way when the environment variables are "injected" in the container rather than defined via an .env.testing file that sounds like optional based on Laravel Docs. We know the environment variables are somehow available in the container because all remaining tests runs successfully.
What Happened
When running Pest tests inside a docker container that does NOT contain either a .env.testing or a .env file, we systematically get the following warning when the first 2 tests are executed :
→ file_get_contents(/usr/share/nginx/lp-opn/.env): Failed to open stream: No such file or directory
.Environment variables are injected inside the container using docker compose env_file option.
Surprisingly, the rest of the test are running just fine.
We don't have this behaviour when running equivalent tests with phpunit.
How to Reproduce
Starting with an existing Laravel app with a Pest Test suite:
Sample Repository
https://dev.azure.com/CSPS-EFPC-UX/learning-platform/_git/lp-opn
Pest Version
2.24.0
PHP Version
8.1.26
Operation System
Linux
Notes
No response