-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] deprecate booting the kernel twices #32056
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
[DI] deprecate booting the kernel twices #32056
Conversation
25f9522
to
b849aab
Compare
This looks like BC-break |
And I agree with @Koc, this has potential to break lots of tests if I don't miss anything. We could deprecate this in 4.4 though and throw in 5.0 then. |
By the way, our test suite contains an example of a valid test that would fail with this change (see the failing CI jobs). |
b849aab
to
29a08ee
Compare
PR rebase with 4.4, tests fixed and deprecation added. |
29a08ee
to
b5aabd9
Compare
b5aabd9
to
905bec4
Compare
cc @fabpot |
Thank you @Simperfit. |
This PR was merged into the 4.4 branch. Discussion ---------- [DI] deprecate booting the kernel twices | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #31233 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | ? <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> This adds a check to see if the kernel has been booted twices in a single test, and throw a deprecation Commits ------- 905bec4 [DI] throw an exception when the kernel has been booted twices
This means we cannot boot the kernel, set some state in a service (e.g. fixture data in memory), then create the client to test requests. WDYT about not (re)booting the kernel if it's already booted? Edit: Never mind. This wouldn't work as |
…eal one instead (nicolas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] Don't reset the test container but the real one instead | Q | A | ------------- | --- | Branch? | 4.4 for features / 3.4 or 4.3 for bug fixes <!-- see below --> | Bug fix? | yes/no | New feature? | yes/no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | - After #31202 and #32056, the tearDown method keeps throwing deprecation notices about "Getting the container from a non-booted kernel". The reason is that resetting the test-container calls `$kernel->getContainer()` while the kernel has been shut down. This fixes it and a few other glitches found meanwhile. Commits ------- 8e16143 [FrameworkBundle] Dont reset the test container but the real one instead
Hi @Simperfit We just upgraded to SF 4.4 and now there's this deprecation notice, but tbh, we don't know how to fix it. The docs say that you specifically need to create 2 clients here, but this is now not allowed. Actually, doing what the docs say leads to an exception in SF 5 https://symfony.com/doc/current/testing/insulating_clients.html What's the proper upgrade path if we need multiple clients? |
@acasademont Please open a new issue. Thank you |
This adds a check to see if the kernel has been booted twices in a single test, and throw a deprecation