Behat致命错误:界面&Behat \ Behat \ Context \ Context'未找到

时间:2015-11-26 16:33:07

标签: php phpstorm bdd behat

我正在尝试在成功安装和配置后运行Behat功能文件。我收到以下错误:

  

致命错误:界面&Behat \ Behat \ Context \ Context'找不到   第22行的C:\ Apache24 \ htdocs \ drupal \ sites \ all \ themes \ ec_resp \ emn_ies_subtheme \ vendor \ behat \ behat \ features \ bootstrap \ FeatureContext.php

FeatureContext.php中的第22行:

class FeatureContext implements Context

Context类正在引用:

use Behat\Behat\Context\Context;

这是我的文件夹结构:

enter image description here

我不知道这里出了什么问题,因为我还没有改变或移动任何核心的Behat文件。

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

我可能会迟到一点,但是我面临着同样的问题。问题是,我在错误的文件夹中运行了behat文件。

所以我的文件夹结构如下:

|-project
|
|--tests
|
|---vendor
|
|----bin
|
|-----behat

如果我尝试像这样在项目文件夹中运行behat文件:

[project]$ test/vendor/bin/behat

我会得到错误

  

FeatureContext上下文类未找到,无法使用。

所以我必须位于tests文件夹中,然后我才能毫无问题地运行测试。

[tests]$ vendor/bin/behat

希望它仍在回答问题。