-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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 our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Did you experience any nasty side effect of this not being reset? Can you add a corresponding test case? |
53c0f9f
to
1f205d8
Compare
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 in 53c0f9f
|
1f205d8
to
3debd21
Compare
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? |
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 |
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
to
a18c510
Compare
Thank you @core23. |
This currently is now breaking in our cases the tests as we are defining the And now as it is set to |
Can this be related?
I have already framework.test=true. |
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;
+ } |
When using the
KernelTestCase
for multiple different test kernels, theKernelTestCase::$class
is not reseted after the test has finished. All other class variables are set to the initial state, so this change should be a bugfix.