Please sign in to comment.
bug #27501 [FrameworkBundle] Fix test-container on kernel reboot, rev…
…ert to returning the real container from Client::getContainer() (nicolas-grekas) This PR was merged into the 4.1 branch. Discussion ---------- [FrameworkBundle] Fix test-container on kernel reboot, revert to returning the real container from Client::getContainer() | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | - | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27494 | License | MIT | Doc PR | - By making `Client::getContainer()` return the new test container, we broke BC, as spotted in linked issue. Always use `static::$container` in your tests instead. While reverting to returning the real container, I noticed we have a serious design issue in the way the test container currently works: because the kernel can be rebooted, we cannot inject the container directly, but have to go through the kernel all the time. Fixing this forces doing a BC break on the constructor of `TestContainer`. Since this is a new class and since it's mostly internal, I think we should do it now. I've marked the class as internal to further strengthen this. Commits ------- 6764d4e [FrameworkBundle] Fix test-container on kernel reboot, revert to returning the real container from Client::getContainer()
- Loading branch information...
Showing with 82 additions and 47 deletions.
- +2 −6 src/Symfony/Bundle/FrameworkBundle/Client.php
- +2 −6 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TestServiceContainerRealRefPass.php
- +2 −2 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TestServiceContainerWeakRefPass.php
- +6 −8 src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml
- +63 −18 src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php
- +2 −2 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php
- +4 −4 src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php
- +1 −1 src/Symfony/Bundle/SecurityBundle/composer.json