From 67afe83dd4f049fc2acc8b78534fb91e97edfef5 Mon Sep 17 00:00:00 2001 From: Tavo Nieves J Date: Fri, 29 Jan 2021 11:32:40 -0500 Subject: [PATCH] Update Symfony connector --- src/Codeception/Lib/Connector/Symfony.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Codeception/Lib/Connector/Symfony.php b/src/Codeception/Lib/Connector/Symfony.php index a50d1214..4dfca1fe 100644 --- a/src/Codeception/Lib/Connector/Symfony.php +++ b/src/Codeception/Lib/Connector/Symfony.php @@ -19,7 +19,7 @@ class Symfony extends HttpKernelBrowser /** * @var bool */ - private $rebootable = true; + private $rebootable; /** * @var bool @@ -29,7 +29,7 @@ class Symfony extends HttpKernelBrowser /** * @var ContainerInterface */ - private $container = null; + private $container; /** * @var array @@ -49,7 +49,7 @@ public function __construct(Kernel $kernel, array $services = [], bool $rebootab $this->followRedirects(true); $this->rebootable = $rebootable; $this->persistentServices = $services; - $this->container = $this->kernel->getContainer(); + $this->container = $this->getContainer(); $this->rebootKernel(); } @@ -86,10 +86,9 @@ public function rebootKernel(): void } } - $this->kernel->shutdown(); - $this->kernel->boot(); + $this->kernel->reboot(null); - $this->container = $this->kernel->getContainer(); + $this->container = $this->getContainer(); foreach ($this->persistentServices as $serviceName => $service) { try { @@ -105,6 +104,16 @@ public function rebootKernel(): void } } + private function getContainer(): ?ContainerInterface + { + /** @var ContainerInterface $container */ + $container = $this->kernel->getContainer(); + if ($container->has('test.service_container')) { + $container = $container->get('test.service_container'); + } + return $container; + } + private function getProfiler(): ?Profiler { if ($this->container->has('profiler')) {