我第一次用一个简单的例子测试Behat/Mink。当我启动behat时,会出现以下错误:
PHP Fatal error: Class 'Behat\Behat\Context\Step\Given' not found in /var/www/behat-test/features/bootstrap/FeatureContext.php on line 31
features/bootstrap/FeatureContext.php :
<?php
require_once './vendor/autoload.php';
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\MinkExtension\Context\MinkContext;
use Behat\Behat\Context\Step;
class FeatureContext extends MinkContext implements Context, SnippetAcceptingContext
{
// ......
/**
* @Given I am logged in as :username
*/
public function iAmLoggedInAs($username)
{
return array(
new Step\Given('I go to "login.php"'), // line 31
new Step\When('I fill in "My name" with '.$username),
new Step\When('I press "Login"')
);
}
}发布于 2015-03-05 16:17:03
在Behat2中,给定/何时/然后类用于步骤链接。由于这一技术带来了更多的问题--(与维护有关)--然后带来了好处,因此在Behat3中不再支持它们(显然您正在使用)。也不建议采取这种做法。
https://stackoverflow.com/questions/28877993
复制相似问题