8000 bug #45414 [FrameworkBundle] KernelTestCase resets internal state on … · symfony/symfony@3e9a6e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e9a6e3

Browse files
bug #45414 [FrameworkBundle] KernelTestCase resets internal state on tearDown (core23)
This PR was submitted for the 6.1 branch but it was merged into the 4.4 branch instead. Discussion ---------- [FrameworkBundle] KernelTestCase resets internal state on tearDown | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | When using the `KernelTestCase` for multiple different test kernels, the `KernelTestCase::$class` is not reseted after the test has finished. All other class variables are set to the initial state, so this change should be a bugfix. Commits ------- a18c510 KernelTestCase resets internal state on tearDown
2 parents 25ec51d + a18c510 commit 3e9a6e3

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ abstract class KernelTestCase extends TestCase
4444
private function doTearDown()
4545
{
4646
static::ensureKernelShutdown();
47+
static::$class = null;
4748
static::$kernel = null;
4849
static::$booted = false;
4950
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TestServiceContainerTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,22 @@ public function testThatPrivateServicesAreAvailableIfTestConfigIsEnabled()
4444
$this->assertTrue(static::$container->has('private_service'));
4545
$this->assertFalse(static::$container->has(UnusedPrivateService::class));
4646
}
47+
48+
/**
49+
* @doesNotPerformAssertions
50+
*/
51+
public function testBootKernel()
52+
{
53+
static::bootKernel(['test_case' => 'TestServiceContainer']);
54+
}
55+
56+
/**
57+
* @depends testBootKernel
58+
*/
59+
public function testKernelIsNotInitialized()
60+
{
61+
self::assertNull(self::$class);
62+
self::assertNull(self::$kernel);
63+
self::assertFalse(self::$booted);
64+
}
4765
}

0 commit comments

Comments
 (0)
0