Skip to content

Commit

Permalink
[FrameworkBundle] Do not access the container when the kernel is shut…
Browse files Browse the repository at this point in the history
… down
  • Loading branch information
jderusse committed Sep 20, 2024
1 parent d022058 commit 9ae1957
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Test/KernelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,15 @@ protected static function ensureKernelShutdown()
if (null !== static::$kernel) {
static::$kernel->boot();
$container = static::$kernel->getContainer();
static::$kernel->shutdown();
static::$booted = false;

if ($container->has('services_resetter')) {
// Instantiate the service because Container::reset() only resets services that have been used
$container->get('services_resetter');
}

static::$kernel->shutdown();
static::$booted = false;

if ($container instanceof ResetInterface) {
$container->reset();
}
Expand Down

0 comments on commit 9ae1957

Please sign in to comment.