Search code examples
phpzend-frameworkbehatmink

Mink instance has not been set on Mink context class. Have you enabled the Mink Extension? (RuntimeException)


i'm trying to use mink with Behat on Zend framework 1 but when i run Behat command i get this error "Mink instance has not been set on Mink context class. Have you enabled the Mink Extension? (RuntimeException)"

here's my composer:

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

&here's my behat.yml:

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

&here's my feature :

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"

& my 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()
    {
    }
}

Solution

  • In Behat 3 you should enable Behat\MinkExtension instead of Behat\MinkExtension\Extension

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