2

When I run bin/behat I get this error.

PHP Fatal error: Class 'Symfony\Component\Console\Application' not found in /vendor/behat/behat/src/Behat/Behat/Console/BehatApplication.php on line 31

My composer.json file contains this:

{
"require": {
"drupal/drupal-extension": "",
"behat/behat": "2.4.
@stable",
"behat/mink": "1.4@stable",
"behat/mink-goutte-driver": "",
"behat/mink-selenium-driver": "
",
"behat/mink-selenium2-driver": "",
"behat/mink-sahi-driver": "
",
"behat/mink-zombie-driver": "",
"behat/mink-extension": "
"
},
"minimum-stability": "dev",
"config": {
"bin-dir": "bin/"
}
}

And for some reason symfony/CssSelector is failing to clone:

[RuntimeException]
Failed to clone via git, https and http protocols, aborting.

mgbellaire
  • 81
  • 2
  • 7

3 Answers3

3

I suggest removing bin, vendor folders and composer.lock file and running php composer.phar install again, the packages should install fine then.

zalex007
  • 81
  • 3
1

Composer is a only a Method for installing Behat you can remove Behat and try with one of following Method :

The simplest way to install Behat is through Composer.

Method #1 (Composer)

Create composer.json file in the project root:

{
    "require": {
        "behat/behat": "2.4.*@stable"
    },
    "minimum-stability": "dev",
    "config": {
        "bin-dir": "bin/"
    }
}

Then download composer.phar and run install command:

$ curl http://getcomposer.org/installer | php
$ php composer.phar install

Composer uses GitHub zipball service by default and this service is known for outages from time to time. If you get

The ... file could not be downloaded (HTTP/1.1 502 Bad Gateway) during installation, just use --prefer-source option:

$ php composer.phar install --prefer-source

After that, you will be able to run Behat with:

$ bin/behat

Method #2 (PHAR)

Also, you can use behat phar package:

$ wget https://github.com/downloads/Behat/Behat/behat.phar

Now you can execute Behat by simply running phar archive through php:

$ php behat.phar

Method #3 (Git)

You can also clone the project with Git by running:

$ git clone git://github.com/Behat/Behat.git && cd Behat
$ git submodule update --init

Then download composer.phar and run install command:

$ wget -nc http://getcomposer.org/composer.phar
$ php composer.phar install

After that, you will be able to run Behat with:

$ bin/behat
AMH
  • 461
  • 5
  • 12
1

try with loading --config option of behat.yml

bin/behat -v --config=app/config/behat.yml

Also not sure if you are running symfony or drupal instance.

See detail configuration of my behat+mink+selenium+symfony2.8 installation here

Community
  • 1
  • 1
aniruddha
  • 689
  • 8
  • 29