Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent result when calling $this->dotenv->load() multiple times from PHPUnit #567

Open
bilogic opened this issue Apr 26, 2024 · 0 comments

Comments

@bilogic
Copy link

bilogic commented Apr 26, 2024

https://gist.github.com/bilogic/4114836067651905888abd542becee55

I have a set of flaky tests in the gist above. What I can't understand is:

  1. If the tests are ran individually, they all pass
  2. If PHPUnit is used to run them all, test_Can_detect_missing_mandatory_environment_keys fails and it is due to $this->dotenv->load(); returning an empty array here https://gist.github.com/bilogic/4114836067651905888abd542becee55#file-envchecker-php-L61
  3. If I re-order test_Can_detect_missing_mandatory_environment_keys as the first test, it passes and now test_Can_parse_environment_file fails due to the same issue of an empty array

Any idea what I'm missing here?

@bilogic bilogic changed the title $this->dotenv->load() sometimes returns an empty array Inconsistent result when calling $this->dotenv->load() multiple times from PHPUnit Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant