Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Codeception/Module/Symfony/ServicesAssertionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ trait ServicesAssertionsTrait
{
/**
* Grabs a service from the Symfony dependency injection container (DIC).
* In "test" environment, Symfony uses a special `test.service_container`.
* In the "test" environment, Symfony uses a special `test.service_container`.
* See the "[Public Versus Private Services](https://symfony.com/doc/current/service_container/alias_private.html#marking-services-as-public-private)" documentation.
* Services that aren't injected somewhere into your app, need to be defined as `public` to be accessible by Codeception.
* Services that aren't injected anywhere in your app, need to be defined as `public` to be accessible by Codeception.
*
* ```php
* <?php
Expand All @@ -25,7 +25,8 @@ public function grabService(string $serviceId): object
{
if (!$service = $this->getService($serviceId)) {
$this->fail("Service `{$serviceId}` is required by Codeception, but not loaded by Symfony since you're not using it anywhere in your app.\n
Recommended solution: Set it to `public` in your `config/services_test.php`/`.yaml`, see https://symfony.com/doc/current/service_container/alias_private.html#marking-services-as-public-private");
Recommended solution: Set it to `public` in your `config/services.php`/`.yaml`, see https://symfony.com/doc/current/service_container/alias_private.html#marking-services-as-public-private\n
Besides, `test` needs to be set to `true` in your `config/packages/framework.php`/`.yaml`, see https://symfony.com/doc/current/reference/configuration/framework.html#test");
}

return $service;
Expand Down
Loading