Skip to content

The kernel reboot #130

Open
Open
@Legion112

Description

@Legion112

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:

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions