Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

KerneltestCase: Discrepancy between self::$kernel and static::$kernel #47186

Copy link
Copy link
Closed
@flack

Description

@flack
Issue body actions

Symfony version(s) affected

4.4.39

Description

I just updated an ancient Symfony 4.4 app and noticed that in release 4.4.39 out unit tests break due to symfony/framework-bundle@cd52737

After debugging I noticed that this happens because bootKernel assigns the new kernel to self::$kernel, but a few lines down, the container is read from static::$kernel, which in my case is a different class (i.e. my test class extending KernelTestcase):

https://github.com/symfony/framework-bundle/blob/3cbca8f6b93681102cab0fe0e3c23d16e4d0ded3/Test/KernelTestCase.php#L80-L83

How to reproduce

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class MyTest extends WebTestCase
{
    protected static $kernel;

    public function testUserlist()
    {
        static::createClient();
   }
}

Possible Solution

change all occurences to either self or static

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.