| Q |
A |
| Bug report? |
no |
| Feature request? |
no |
| BC Break report? |
no |
| RFC? |
no |
| Symfony version |
3.4.0-DEV |
Up until 3.3, I would often make use of container services from within my WebTestCases, like this:
$um = $container->get('fos_user.user_manager');
$user = $um->findUserByEmail('johndoe@example.com');
However, fos_user.user_manager is a private service, and 3.4 deprecates retrieving those through the container.
The easy way out is to alias the service to make it public in services.yml, like this:
fos_user.user_manager.public:
alias: fos_user.user_manager
public: true
but that doesn't feel like the right thing to do.
I tried to get setter injection working, but this seems to be limited to classes within the container, and doesn't seem to work for WebTestCase classes.
Is there a general/idiomatic approach to access private services from within WebTestCase classes?