Skip to content

Commit de81c28

Browse files
committed
Ensure congruence with the flow in the Symfony KernelTestCase
1 parent 4ee70f9 commit de81c28

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/Codeception/Lib/Connector/Symfony.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(
3131
parent::__construct($kernel);
3232
$this->followRedirects();
3333
$this->container = $this->getContainer();
34-
$this->rebootKernel(); // Ensure the profiler exists
34+
$this->rebootKernel();
3535
}
3636

3737
/** @param Request $request */
@@ -47,7 +47,7 @@ protected function doRequest(object $request): Response
4747
}
4848

4949
/**
50-
* Reboot kernel
50+
* Reboots the kernel.
5151
*
5252
* Services from the list of persistent services
5353
* are updated from service container before kernel shutdown
@@ -64,8 +64,7 @@ public function rebootKernel(): void
6464
}
6565

6666
$this->persistDoctrineConnections();
67-
$this->kernel->boot();
68-
$this->kernel->shutdown();
67+
$this->ensureKernelShutdown();
6968
$this->kernel->boot();
7069
$this->container = $this->getContainer();
7170

@@ -82,6 +81,12 @@ public function rebootKernel(): void
8281
}
8382
}
8483

84+
protected function ensureKernelShutdown(): void
85+
{
86+
$this->kernel->boot();
87+
$this->kernel->shutdown();
88+
}
89+
8590
private function getContainer(): ?ContainerInterface
8691
{
8792
/** @var ContainerInterface $container */
@@ -120,7 +125,9 @@ private function persistDoctrineConnections(): void
120125
}
121126

122127
$reflectedContainer = new ReflectionClass($publicContainer);
123-
$reflectionTarget = $reflectedContainer->hasProperty('parameters') ? $publicContainer : $publicContainer->getParameterBag();
128+
$reflectionTarget = $reflectedContainer->hasProperty('parameters')
129+
? $publicContainer
130+
: $publicContainer->getParameterBag();
124131

125132
$reflectedParameters = new ReflectionProperty($reflectionTarget, 'parameters');
126133
$reflectedParameters->setAccessible(true);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy