You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
protected function doRequest($request): Response
{
$response = parent::doRequest($request);
if ($this->rebootable) {
$this->rebootKernel();
}
return $response;
}
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:
$I->sendGet('/some/path');
$stub = $I->grabServise(ExternalApiStub::clase);
$stub->setFakeResponse('This is a fake response from external API');
$I->sendGet('/some/path'); // here kernel rebootes and state of DI container is lost
The text was updated successfully, but these errors were encountered:
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.
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.
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:
The text was updated successfully, but these errors were encountered: