Skip to content

Commit 802821f

Browse files
Improved grabService error message (#20)
* Update Symfony.php Adding hint about unused services not being available, see Codeception/Codeception#5828 and https://stackoverflow.com/a/63131476/1668200 * Update Symfony.php Switching to *test* config, see Codeception/Codeception#5828 (comment)
1 parent c32f3e1 commit 802821f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,9 @@ public function grabService($service)
574574
{
575575
$container = $this->_getContainer();
576576
if (!$container->has($service)) {
577-
$this->fail("Service $service is not available in container");
577+
$this->fail("Service $service is not available in container.
578+
If the service isn't injected anywhere in your app, you need to set it to `public` in your `config/services_test.php`/`.yaml`,
579+
see https://symfony.com/doc/current/testing.html#accessing-the-container");
578580
}
579581
return $container->get($service);
580582
}

0 commit comments

Comments
 (0)