Open Legion112 opened 3 years ago
@Legion112 could you please send a PR for this?
It would also help to have a test in our test project ( Codeception/symfony-module-tests ) with which we verify that your change solves the issue (and that it will not be damaged in future versions).
Please follow the contribution guide ( master/CONTRIBUTING.md ), and if all goes well I will gladly merge the changes.
Hello!
I also would like to notice that way this module is reboot Symfony Kernel differ from way doing that in Symfony KernelTestCase. Looks like this leads to services which implements Symfony\Contracts\Service\ResetInterface are not reset.
Look at https://github.com/symfony/symfony/issues/40965 for example.
@Legion112 @TavoNiievez is there any progress on this issue? Thanks!
Sorry no longer work with codeception.
We used static variables for setting the state of stub classes. This has one downside as it you need to reset the state between tests yourself.
I think the process of rebooting the kernel should be done right after the request has been finished. Here we have logic that will reboot the kernel only when a second request is made. https://github.com/Codeception/module-symfony/blob/master/src/Codeception/Lib/Connector/Symfony.php#L63 I think we should change it to:
Why is it important? If the kernel is rebooted only when a second request happened - we cannot configure the "DI" container on the fly. Like setting Stubs classes. Something like this: