When running `bin/behat` I get a “Class not found” error

China☆狼群 提交于 2019-12-06 07:47:04

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

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
aniruddha

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!