【问题标题】:Mink instance has not been set on Mink context class. Have you enabled the Mink Extension? (RuntimeException)Mink 实例尚未在 Mink 上下文类中设置。您是否启用了 Mink 扩展程序? (运行时异常)
【发布时间】:2015-07-16 05:56:08
【问题描述】:

我正在尝试在 Zend 框架 1 上将 mink 与 Behat 一起使用,但是当我运行 Behat 命令时,我收到此错误“Mink 实例尚未在 Mink 上下文类上设置。您是否启用了 Mink 扩展?(RuntimeException)”

这是我的作曲家:

"behat/behat": "^3.0@dev",
"behat/mink": "1.5.*@stable",
"behat/mink-goutte-driver": "*",
"behat/mink-extension": "*"

&这里是我的 behat.yml:

default:
    extensions:
        Behat\MinkExtension\Extension:
            base_url: http://en.wikipedia.org
            goutte: ~

&这是我的特色:

Feature: Search
   In order to see a word definition
   As a website user
   I need to be able to search for a word

  Scenario: Searching for a page that does exist
    Given I am on "/wiki/Main_Page"
    When I fill in "search" with "Behavior Driven Development"
    And I press "searchButton"
    Then I should see "agile software development"

&我的 FeatureContext.php:

<?php

use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext;

class FeatureContext extends Behat\MinkExtension\Context\MinkContext
{
    public function __construct()
    {
    }
}

【问题讨论】:

  • 你的完整例子是here

标签: php zend-framework behat mink


【解决方案1】:

在 Behat 3 中,您应该启用 Behat\MinkExtension 而不是 Behat\MinkExtension\Extension

default:
    extensions:
        Behat\MinkExtension:
            base_url: http://en.wikipedia.org
            goutte: ~

【讨论】:

  • @ahmed 如果这个答案对你有用,那么你可以投票。
猜你喜欢
  • 2020-08-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多