Skip to content

Private services in tests #213

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

Closed
darthf1 opened this issue Nov 30, 2021 · 3 comments
Closed

Private services in tests #213

darthf1 opened this issue Nov 30, 2021 · 3 comments

Comments

@darthf1
Copy link
Contributor

darthf1 commented Nov 30, 2021

Hi!

After #211 I get a lot of Service 'xxx' is private, which is normally a good thing. But In my codebase I get these messages solely when I fetch services in my functional tests.

Example:

$service = self::getContainer()->get('messenger.transport.default'),

Mesage:

Service "messenger.transport.default" is private.

https://symfony.com/doc/current/testing.html#retrieving-services-in-the-test states:

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

So, I'm not sure whether these issues should be given by default for the test container as well. For now I can ignore these messages from my test folder.

@ondrejmirtes
Copy link
Member

Please see if a change in the spirit of this PR works for you: #212

Thanks.

@darthf1
Copy link
Contributor Author

darthf1 commented Nov 30, 2021

Ah, yeah that should fix it. Closing since its already being worked on :)

@darthf1 darthf1 closed this as completed Nov 30, 2021
@github-actions
Copy link

github-actions bot commented Jan 1, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants