Skip to content
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

Add instructions about testing unused private services #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

loevgaard
Copy link
Contributor

Fixes #72

@chapterjason
Copy link
Contributor

I don't think this is required anymore?

@loevgaard
Copy link
Contributor Author

I think it is, @chapterjason. Why do you think it isn't? :)

@chapterjason
Copy link
Contributor

chapterjason commented Nov 3, 2023

I don't see any value here as you can easily make them available by make them public in a test config like described in the symfony documentation

The container from static::getContainer() is actually a special test container. It gives you access to both the public services and the non-removed private services.

Yes I know you mean removed ones:

If you need to test private services that have been removed (those who are not used by any other services), you need to declare those private services as public in the config/services_test.yaml file.

You can do this in bundle test by simply loading a test config with the method addTestConfig from the TestKernel.

Edit: We actually could add a bit documentation how to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why was PublicServicePass removed in v2?
2 participants