douchen4534 2015-03-05 12:34
浏览 34
已采纳

Behat 3 - Behat \ Behat \ Context \ Step \鉴于未找到

I'm testing Behat/Mink for the first time with a simple example. When I launch behat I have this error :

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"')
        );
    }
}
  • 写回答

1条回答 默认 最新

  • drasebt1835 2015-03-05 16:17
    关注

    In Behat2, Given/When/Then classes were used for step chaining. Since this technique brought more problems (with maintenance) then benefits, they're no longer supported in Behat3 (which you apparently use). It's also not recommended to follow this practice.

    See https://github.com/Behat/Behat/issues/546.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥15 看一下OPENMV原理图有没有错误
  • ¥100 H5网页如何调用微信扫一扫功能?
  • ¥15 讲解电路图,付费求解
  • ¥15 有偿请教计算电磁学的问题涉及到空间中时域UTD和FDTD算法结合的
  • ¥15 vite打包后,页面出现h.createElement is not a function,但本地运行正常
  • ¥15 Java,消息推送配置
  • ¥15 Java计划序号重编制功能,此功能会对所有序号重新排序,排序后不改变前后置关系。
  • ¥15 关于哈夫曼树应用得到一些问题