简体   繁体   中英

codeception doesn't builds helper files automatically

I have an YII2 application project with connected Codeception 4.1.8 testing framework (during the life of project before me there where made a lot of modifications). So I tried to add my own method to the acceptance tester via adding to the tests/_support/Helper/Acceptance.php such a code:

<?php
namespace Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class Acceptance extends \Codeception\Module
{
    public function setRESTURL() {
        $this->getModule('REST')->_reconfigure(['url' => 'https://www.blabla.com']);
    }
}

-- but, after re-building of the acceptance tester (../vendor/bin/codecept build) and running a test with

$i->setRESTURL();

code inside I'm getting an error "[RuntimeException] Call to undefined method tests\actor\RegisteredTester::setRESTURL", so obvious that helper add-ons weren't included to the acceptance tester class.

So my question is - is there some ways to "switch on" the automatic including helper files to the codeception tester classes? (as far as I got they should be included by default but seems that in project where made some changes to exclude them in some way).

You haven't shared your acceptance.suite.yml file, but you are asking for automatic inclusion, so I guess that you haven't enabled Acceptance helper in acceptance.suite.yml file.

It must look like this:

actor: AcceptanceTester
modules:
    enabled:
        - \Helper\Acceptance
        - REST:
            depends: Yii2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM