Skip to content

Commit afe3e49

Browse files
committed
fix: compatibility with symfony 5.x and phpunit kernel test case
1 parent fab7e37 commit afe3e49

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Test/AbstractElasticsearchTestCase.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private function populateElastic(IndexService $indexService, array $documents =
7272
protected function tearDown(): void
7373
{
7474
parent::tearDown();
75-
75+
self::$cachedContainer = null;
7676
foreach ($this->indexes as $name => $index) {
7777
try {
7878
$index->dropIndex();
@@ -84,9 +84,12 @@ protected function tearDown(): void
8484

8585
protected static function getContainer($reinitialize = false, $kernelOptions = []): ContainerInterface
8686
{
87-
if (!self::$cachedContainer && !$reinitialize) {
88-
// static::bootKernel($kernelOptions);
87+
if ($reinitialize && self::$booted) {
88+
self::ensureKernelShutdown();
89+
self::$cachedContainer = null;
90+
}
8991

92+
if (!self::$cachedContainer) {
9093
self::$cachedContainer = static::createClient(['environment' => 'test'])->getContainer();
9194
}
9295

0 commit comments

Comments
 (0)