Skip to content

Private services in tests #213

Closed
Closed
@darthf1

Description

@darthf1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions