Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Cannot redeclare AcceptanceTesterActions #3208
Somehow we are having trouble enabling these three modules. Yii2 and Webdriver play nicely together but when we add DataFactory we get a duplicate class Exception.
Build runs OK:
class_name: AcceptanceTester modules: enabled: - WebDriver: restart: false clear_cookies: false browser: firefox url: http://localurl - Yii2: part: ORM configFile: 'codeception/config/acceptance.php' - DataFactory: factories: tests/_support/factories depends: Yii2 env: acceptance: modules: config: WebDriver: browser: phantom url: http://accurl
We are using Codeception version 2.2.1.
Having exactly the same issue with Yii2 and DataFactory in functional tests
Looking at the stack trace I can see my Cest file is first loaded in Codeception/Lib/Parser::includeFile(), line 197
then it's loaded again from League/FactoryMuffin/FactoryMuffin::loadDirectory() line 351
My functional_suite.yml file is:
class_name: FunctionalTester modules: enabled: - Filesystem - Yii2 - DataFactory: factories: tests/_support/factories depends: Yii2 - \tests\codeception\frontend\Helper\Factories config: Yii2: configFile: '../config/frontend/functional.php'
I think I've found the bug. In both the files you specify:
But seeing the code, it expects a path relative to the codeception.yml file. However Yii2 specifies a subfolder in tests (codeception) and that's why it does not work.
Then because Codeception uses realpath:
This returns false if the directory does not exist. This results in factoryMuffin to load a empty directory (so basically it tries to load every php file in the Codeception folder). This is why it gets the duplicate class exception.
I will put in a pull request that throws an Exception when the factory folder can not be found and will update the documentation.