Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
allow Symfony 4 #346
I can reproduce the error on my computer, here is the content of the file that cause the error:
It looks like
When i try to rerun only one test in order to identify the error, then the error disappear!
Example when launching tests with
./vendor/bin/phpunit --filter ConfigurationConfigTest PHPUnit 6.5.1 by Sebastian Bergmann and contributors. ........... 11 / 11 (100%) Time: 1.33 seconds, Memory: 8.00MB OK (11 tests, 33 assertions)
The fact that the error only appeared when all the test suite was run made me think that it was due to the fact that tests are launched in separate processes (due to different Kernel which load different configuration).
I think that I found a solution:
* @runTestsInSeparateProcesses * @preserveGlobalState disabled
See related documentation: https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.preserveGlobalState
Sorry to complicate things, but there is one issue you guys may not be aware of. In DoctrineFixturesBundle 3.0 (which is what people will need to start using in a bundleless setup), fixture classes are actually tagged services. This creates a problem with this bundle, as it tries to instantiate the fixtures. Instead, for DoctrineFixturesBundle 3.0, in a compiler pass, we call
One solution might be to create your own service (in a compiler pass) that is passed all tagged repositories. This class would be a simple map of the repo objects: it could have a method like
$loader = new SymfonyFixturesLoader($container); $loader->addFixtures($fixtureObjects);
Hopefully the other fixtures libraries will follow this new pattern, and eventually it might simplify some logic in the library. If you have any questions, please let me know!