Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] KernelTestCase resets internal state on tearDown#45414
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedFeb 13, 2022
Did you experience any nasty side effect of this not being reset? Can you add a corresponding test case? |
core23 commentedFeb 13, 2022
IMHO it should only have a minimum performance impact, because the name is resolved for every test: symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php Lines 126 to 128 in53c0f9f
|
nicolas-grekas commentedFeb 14, 2022
It could have a performance impact. That's why I'm asking. Why do you want to reset this property, if everything is fine when it is not reset? |
core23 commentedFeb 14, 2022
I have some projects that will perform web tests with different kernel configuration. This can also be the case, if you provide a bundle with optional dependencies that will result in a slightly different service configuration. At the moment, I have to manuell reset the |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for the explanation, that's what I was missing.
3debd21 toa18c510Comparenicolas-grekas commentedFeb 18, 2022
Thank you@core23. |
alexander-schranz commentedMar 2, 2022
This currently is now breaking in our cases the tests as we are defining the And now as it is set to |
mwalczak commentedMar 2, 2022
Can this be related? I have already framework.test=true. |
nicolas-grekas commentedMar 2, 2022
alexander-schranz commentedMar 2, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I could workaround my issue by changing: - protected static $class = S3Kernel::class;+ protected static function getKernelClass(): string+ {+ return S3Kernel::class;+ } EDIT: for prefer lowest tests I had to readd the + protected static $class = S3Kernel::class;++ protected static function getKernelClass(): string+ {+ return S3Kernel::class;+ } |
Uh oh!
There was an error while loading.Please reload this page.
When using the
KernelTestCasefor multiple different test kernels, theKernelTestCase::$classis not reseted after the test has finished. All other class variables are set to the initial state, so this change should be a bugfix.