我正试图运行一个Cest格式的验收测试,却收到了这个我无法理解的错误。非常感谢您的帮助
可捕获的致命错误:传递给Codeception''Module::__construct()的参数1必须是Codeception''Lib''ModuleContainer的实例,给定null,在第13行的C:''CodeCeption''branchs''suites_hydra''tests_support''CcHelper.php中调用,并在C:''CodeCeection''bran中定义第52行的ches''suites''hydra''vendor''codeception''coodeception''src''codeception''Module.php
这是我的cest文件
<?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);
}
}
您的问题出现在CcHelper类中
可能是为Codeception 2.0编写的,
CCD_ 1的签名在2.1中有所不同。
修改CcHelper::__construct
方法以期望正确的参数,并将它们传递给父级::__construct。
看看流明模块的简单例子:
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);
}