Skip to content

Commit ba65f5f

Browse files
committed
Fix persistent service for Symfony 3
Catch exceptions thrown by Symfony 4
1 parent 9ecad0a commit ba65f5f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Codeception/Lib/Connector/Symfony.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ public function rebootKernel()
7777
$this->container = $this->kernel->getContainer();
7878

7979
foreach ($this->persistentServices as $serviceName => $service) {
80-
if (!$this->container->initialized($serviceName)) {
80+
try {
8181
$this->container->set($serviceName, $service);
82+
} catch (\InvalidArgumentException $e) {
83+
//Private services can't be set in Symfony 4
84+
codecept_debug("[Symfony] Can't set persistent service $serviceName: " . $e->getMessage());
8285
}
8386
}
8487

0 commit comments

Comments
 (0)