有没有人遇到以下问题:behat 显然工作正常,但它没有预定义的步骤:结果
\tests> php .\behat\behat.phar -di
即使文件 FeatureContext.php 没有定义步骤,也是空的。我的behat版本是2.4.0,它是在PHAR的帮助下安装的,PHP版本是5.4.9。下面是我安装的一些细节。树形结构如下:
tests> dir
Directory: xxx\tests
Mode Name
d---- behat
d---- features
-a--- bootstrap.php
-a--- phpunit.xml
-a--- WebTestCase.php
behat 文件夹包含以下文件:
tests> dir .\behat
Directory: xxx\tests\behat
Mode Name
-a--- behat.phar
-a--- mink.phar
-a--- mink_extension.phar
而功能文件夹只有引导目录
tests> dir .\features
Directory: xxx\tests\features
Mode Name
d---- bootstrap
其中包含唯一具有以下内容的文件 FeatureContext.php
<?php
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
class FeatureContext extends BehatContext
{
public function __construct(array $parameters)
{
// Initialize your context here
}
}