Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add tip about accessing removed services in the testing doc #12647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
Next Next commit
Add tip about accessing removed services in the testing doc
  • Loading branch information
mmenozzi authored and javiereguiluz committed Apr 3, 2020
commit 67dd3c18fbbcb8a1c774b3b38dddca925b2622cf
9 changes: 9 additions & 0 deletions 9 testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,15 @@ allows fetching both public and all non-removed private services::
For a list of services available in your application, use the ``debug:container``
command.

.. tip::

Keep in mind that, if a private service is never used as a dependency of another service in
your application, it is then removed from the container. So, if you try to access a private
service in a test through the special test container and that service isn't used elsewhere
you'll get a ``ServiceNotFoundException``. The solution, depending on the context, is to
define the service as explicitly ``public`` or to inject it where you'll need it so Symfony
doesn't remove it.

.. tip::

The special container that gives access to private services exists only in
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.