Testing standalone bundle - got 'Could not find service "test.service_container".' - PHP symfony

I'm writing a standalone bundle and trying to test it. But got an error:

LogicException: Could not find service "test.service_container". Try updating the "framework.test" config to "true".

I couldn't find anything in the documentation related to this error. How can I fix that?

UPD: I tried obvious solution by creating config/config_test.yml and even renamed extension to .yaml but it didn't help, content of the file is:

    test: true

The content of phpunit.xml.dist (renamed to .txt due to github limitations): phpunit.txt

Asked Oct 12 '21 12:10
avatar smilesrg

3 Answer:

Can you create a small example application that allows to reproduce your issue?

Answered Jun 15 '21 at 13:57
avatar  of xabbuh

Sure, you can check out this https://github.com/inspector-apm/inspector-symfony/tree/0b5af59e85766f33fa5045bccc8c1929587bd4d8 and try to launch tests

Answered Jun 15 '21 at 13:58
avatar  of smilesrg

That's because in 5.3 we unconditionally use the test.service_container service to get the session. This has been fixed on 5.4 in https://github.com/symfony/symfony/pull/41530, we might want to backport part of it. PR welcome!

Answered Jun 15 '21 at 15:04
avatar  of nicolas-grekas