У меня не получается следовать документу в https://codeception.com/docs/modules/Doctrine2. Это ошибка
[ModuleException] Doctrine2: Module can't be accessed
Я хочу получить доступ к $entityManger в модульном тесте. У доктрины bootstrap.php есть функция createEntityManager, которая возвращает entityManager.
#codeception.yml
suites:
unit:
path: .
actor: UnitTester
modules:
enabled:
# add more modules here
- Asserts
settings:
bootstrap: ../config/bootstrap.php
shuffle: true
lint: true
paths:
tests: tests
output: tests/_output
support: tests/_support
data: tests
# unit.suite.yml
actor: UnitTester
modules:
enabled:
- Asserts
- Doctrine2:
connection_callback: ['createEntityManager']
cleanup: true # All doctrine queries will be wrapped in a transaction, which will be rolled back at the end of each test
- \Helper\Unit





Ваша проблема в том, что у вас настроен набор модулей в файле codeception.yml, поэтому ваш unit.suite.yml игнорируется.
Удалите этот раздел из codeception.yml или удалите unit.suite.yml и обновите codeception.yml.
suites:
unit:
path: .
actor: UnitTester
modules:
enabled:
# add more modules here
- Asserts