Skip to content

assertEmailCount stopped working after upgrading to 6.0.5 #45580

Closed
@garak

Description

@garak

Symfony version(s) affected

6.0.5

Description

In a project with Symfony 6.0.3, after upgrading to 6.0.5 I got this error while executing tests (I found that, in general, the problem arises as soon as the container is retrieved):

LogicException: Could not find service "test.service_container". Try updating the "framework.test" config to "true".

/myproj/vendor/symfony/framework-bundle/Test/KernelTestCase.php:98
/myproj/vendor/symfony/framework-bundle/Test/MailerAssertionsTrait.php:121
/myproj/vendor/symfony/framework-bundle/Test/MailerAssertionsTrait.php:25
/myproj/tests/Controller/DefaultControllerTest.php:136

Caused by
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "kernel" service is synthetic, it needs to be set at boot time before it can be used.

If I execute bin/console deb:conf framework I can see that the test configuration is actually set to true
If I execute bin/console de:cont --parameter=kernel.environment I get (as expected) "test".

The only way I found so far to get it working again is adding this to my composer.json:

"conflict": {
        "symfony/framework-bundle": "6.0.5"
    },

How to reproduce

I cannot reproduce the problem on a fresh installation.

Possible Solution

Commenting out $container->reset() in https://github.com/symfony/framework-bundle/blob/6.0/KernelBrowser.php#L155 solves the problem.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions