24

I installed Behat, Mink and a few other related packages. Here is my composer.json file:

  "require":{
    //...
    "behat/behat": "~3.0.6",
    "behat/symfony2-extension": "dev-master",
    "behat/mink": "dev-master",
    "behat/mink-browserkit-driver": "dev-master",
    "behat/mink-goutte-driver": "dev-master",
    "behat/mink-selenium2-driver": "dev-master",
    "phpunit/php-code-coverage": "dev-master",
    "phpunit/phpunit-mock-objects": "dev-master",
    "phpunit/phpunit": "dev-master"
   }

And here is my behat.yml file:

default:
  extensions:
    Behat\Symfony2Extension:
      mink_driver: true
      kernel:
        env: test
        debug: true
    Behat\MinkExtension\Extension:
        base_url: 'http://localhost/app_test.php/'
        #javascript_session: sahi
        browser_name: chrome
        sahi:
        goutte: ~
        selenium2: ~
paths:
    features: features
    bootstrap: %behat.paths.features%/Context

Now when I run behat I get following error: [Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
Behat\MinkExtension\Extension extension file or class could not be located.

Does anyone know how to fix this? Thanks in advance.

SOLVED:

I simply forgot to add this line:

"require": {
//...
"behat/mink-extension": "dev-master",
//... }

and in your behat.yml: comment this:

# mink_driver: true

and change this:

Behat\MinkExtension\Extension:

to this:

Behat\MinkExtension:
smarber
  • 4,201
  • 4
  • 28
  • 64
cute.S
  • 361
  • 3
  • 17

1 Answers1

13

FYI you don't need "behat/mink-extension": "dev-master" any more.

It works for me with:

"behat/behat": "3.*@stable",
"behat/mink": "1.6.*@stable",
"behat/mink-extension": "@stable",
"behat/mink-goutte-driver": "@stable",
i.am.michiel
  • 10,063
  • 7
  • 46
  • 85
Michal
  • 356
  • 3
  • 8
  • Instead all 4 use just last 2. It will install required dependency: `mink` and `behat` desired versions – Vladimir Vukanac Sep 11 '15 at 12:32
  • 1
    But you hide a dependency and rely on transitional dependency to load behat and mink. I am not a fan of such approach. – Michal Sep 22 '15 at 08:40
  • 1
    You are right. I stick with this one liner because I experienced conflicts of version in Behat extensions causing abort of installation. – Vladimir Vukanac Sep 22 '15 at 20:39