I write a unit test in CodeCception, my config Unit.suite.yml
actor: UnitTester
modules:
enabled:
- Asserts
- Symfony:
environment: 'autotest'
step_decorators: ~
I have a separate environment for running Unit test in pipeline - autotest, and I would like to use my services via Codeception\Module\Symfony->grabService, but I get the error that the service should be public, however, if I use the test environment, Symfony loads Symfony\Bundle\FrameworkBundle\Test\TestContainer and there are no errors, is there any way to get Symfony to load this container for the autotest environment?
I tried to make all services public in config/packages/services.yml via
when@autotest:
services:
_defaults:
public: true
autowire: true
autoconfigure: true
I also tried adding each separate service and putting public: true on it, but it didn't help
Set
framework.testtotruein your custom environment.E.g.
I think this might do the trick. Hopefully there aren't other sites where the "test" environment is "assumed" to be literally "test".