symfony-bundle-test
symfony-bundle-test copied to clipboard
Add instructions about testing unused private services
Fixes https://github.com/SymfonyTest/symfony-bundle-test/issues/72
I don't think this is required anymore?
I think it is, @chapterjason. Why do you think it isn't? :)
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.