Codeception / Codeception

Full-stack testing PHP framework
http://codeception.com
MIT License
4.75k stars 1.3k forks source link

"No primary site exists" only when running unit tests - Craft 4 Pro. No issues with functional and acceptance tests in same environment #6730

Closed tommydaltondev closed 4 months ago

tommydaltondev commented 4 months ago

Codeception throws "No primary site exists" only when running unit tests. Functional and acceptance tests continue to work as they did. Not a multi-site craft install and site handle is default.

Codeception 4.2.2 (PHPUnit 9.6.16) and Craft CMS Pro 4.7.0 PHP version 8.1.26. Craft CMS version

Linux 6.5.11-linuxkit



actor: UnitTester
modules:
    enabled:
        - Asserts
        - \Helper\Unit
        - \craft\test\Craft
    step_decorators: ~
Naktibalda commented 4 months ago

It is an issue of \craft\test\Craft module.

Naktibalda commented 4 months ago

It is unusual to enable framework modules in unit suite. It makes all your tests not unit tests, are you sure that you need it there?

leowebguy commented 4 months ago

We followed the dev steps from here

Naktibalda commented 4 months ago

It is a Craft CMS issue, please contact Craft CMS community for support and/or read the code of craft\test\Craft.