对编码感知的功能测试不起作用



我有以下代码:

class FirstCest
{
public function _before(FunctionalTester $I)
{
}
public function _after(FunctionalTester $I)
{
}
public function tryToTest(FunctionalTester $I)
{               
$I->amOnPage('/about');
}
}

这是我的配置:

actor: FunctionalTester
modules:
enabled:
- HelperFunctional
error_level: "E_ALL"

当我尝试运行时:tests/functional/FirstCest.php:tryToTest我得到:

[运行时异常] 调用未定义的方法 功能测试仪::amOnPage

编写自己的模块或使用 PhpBrowser。 我看到你已经开始研究 https://github.com/visavi/codeception-phpixie/.

缺少的明显内容是连接器类。 示例:https://github.com/Codeception/Codeception/blob/2.4.5/src/Codeception/Lib/Connector/Guzzle6.php#L183-L217

连接器类必须扩展BrowserKit\Client类(除非你的框架基于Symfony Http组件,在这种情况下,请查看Symfony模块和连接器的代码(。 并实现 doRequest 方法,该方法将 BrowserKit\Request 对象转换为框架所需的对象,调用框架代码并将框架响应转换为 BrowserKit\Response。

doRequest 方法的中间部分必须基于您为网站编制索引的代码.php。

在评论中提问。

最新更新