Skip to content

Commit 7164b7d

Browse files
authored
Update Symfony connector (#110)
1 parent dbf341b commit 7164b7d

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/Codeception/Lib/Connector/Symfony.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Symfony extends HttpKernelBrowser
1919
/**
2020
* @var bool
2121
*/
22-
private $rebootable = true;
22+
private $rebootable;
2323

2424
/**
2525
* @var bool
@@ -29,7 +29,7 @@ class Symfony extends HttpKernelBrowser
2929
/**
3030
* @var ContainerInterface
3131
*/
32-
private $container = null;
32+
private $container;
3333

3434
/**
3535
* @var array
@@ -49,7 +49,7 @@ public function __construct(Kernel $kernel, array $services = [], bool $rebootab
4949
$this->followRedirects(true);
5050
$this->rebootable = $rebootable;
5151
$this->persistentServices = $services;
52-
$this->container = $this->kernel->getContainer();
52+
$this->container = $this->getContainer();
5353
$this->rebootKernel();
5454
}
5555

@@ -86,10 +86,9 @@ public function rebootKernel(): void
8686
}
8787
}
8888

89-
$this->kernel->shutdown();
90-
$this->kernel->boot();
89+
$this->kernel->reboot(null);
9190

92-
$this->container = $this->kernel->getContainer();
91+
$this->container = $this->getContainer();
9392

9493
foreach ($this->persistentServices as $serviceName => $service) {
9594
try {
@@ -105,6 +104,16 @@ public function rebootKernel(): void
105104
}
106105
}
107106

107+
private function getContainer(): ?ContainerInterface
108+
{
109+
/** @var ContainerInterface $container */
110+
$container = $this->kernel->getContainer();
111+
if ($container->has('test.service_container')) {
112+
$container = $container->get('test.service_container');
113+
}
114+
return $container;
115+
}
116+
108117
private function getProfiler(): ?Profiler
109118
{
110119
if ($this->container->has('profiler')) {

0 commit comments

Comments
 (0)