0
votes

I am attempting to run a Cest formatted acceptance test and getting this error that i just dont understand. any help is appreciated

Catchable fatal error: Argument 1 passed to Codeception\Module::__construct() must be an instance of Codeception\Lib\ModuleContainer, null given, called in C:\CodeCeption\branches\suites_hydra\tests_support\CcHelper.php on line 13 and defined in C:\CodeCeption\bran ches\suites_hydra\vendor\codeception\codeception\src\Codeception\Module.php on line 52

here is my cest file

    <?php

    use test\LocatorsPage as Locators;


    class TabCest
{
    protected $Primarycustomer      = "test";
    protected $Virtualcustomer      = "test2";
    protected $Virtualcustomer2     = "test3";
    protected $ccUserName           = "Automation";
    protected $ccPassword           = "pswd";
    protected $accountNumber        = "12345";
    protected $PrimarycustomerId;
    protected $VirtualcustomerId;
    protected $VirtualcustomerId2;


    public function _before(\CcTester $I )
    {
        $this->CcHelper->functiontest(0, array('I' => $I, $this->Primarycustomer, $this-> Virtualcustomer,$this-> Virtualcustomer2));
    }

    protected function _inject(\Codeception\Module\CcHelper $CcHelper, \Codeception\Module\ActionsHelper $ActionsHelper)
    {
        $this->CcHelper = $CcHelper;
        $this->ActionsHelper = $ActionsHelper;
    }

    public function VerifySuccessfulCCLogin (\CcTester $I, $Primarycustomer, $ccUserName, $ccPassword, $accountNumber)
    {

        $I->maximizeWindow();
        $I->amOnPage('/homepage.php');
        $this->ActionsHelper->loginToAA(1, array('I' => $I, 'userName' => $this->$Primarycustomer));
        $I->loginToAA($I, $Primarycustomer, $ccUserName, $ccPassword);
        $I->selectOption(['xpath' => Locators::$cc_searchBy], 'Account Number');
        $I->fillField(['xpath' => Locators::$cc_searchAccNo], $accountNumber);
        $I->click(['xpath' => Locators::$cc_searchBtn]);
        $I->click(['xpath' => Locators::$cc_account_1 . $accountNumber . Locators::$cc_account_2]);
        $I->waitForElement(Locators::$cc_docDetailstab);
    }
}
1

1 Answers

0
votes

Your problem is in CcHelper class.
Probably it was written for Codeception 2.0,
the signature of Codeception\Module::__construct is different in 2.1.

Modify CcHelper::__construct method to expect correct parameters and pass them to parent::__construct.

Look at Lumen module for simple example:

public function __construct(ModuleContainer $container, $config = null)
{
    $this->config = array_merge(
        array(
            'cleanup' => true,
            'bootstrap' => 'bootstrap' . DIRECTORY_SEPARATOR . 'app.php',
            'root' => '',
            'packages' => 'workbench',
        ),
        (array) $config
    );
    parent::__construct($container);
}