Behat-Laravel-Extension-Example-App
Behat-Laravel-Extension-Example-App copied to clipboard
`Laracasts\Behat` extension file or class could not be located.
Hello,
I may be missing something, but on a totally fresh clone of this repo, then running composer install
and composer update
(mac, OSX yosemite running in homestead)
I get
[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
`Laracasts\Behat` extension file or class could not be located.
Any help would be great, only I'm having a right ol' mare getting Laravel 5 and Behat 3 to work!
Thanks, DanC
Getting same error here.
Ditto. Any progress on this gentlemen?
Leaving a potential solution:
If you're using the global
behat command, it autoloads relative to the global installed version of behat. To get it loading properly, it has to use the local installed version in ./vendor/bin
Here is my solution:
Update the behat.yml
:
default:
extensions:
Laracasts\Behat\ServiceContainer\LaravelExtension:
env_path: .env.behat
Behat\MinkExtension\ServiceContainer\MinkExtension:
default_session: laravel
base_url: http://localhost:8000
laravel: ~
Run behat from vendor:
$ ./vendor/bin/behat
Not sure how I've done it, but here's my behat.yml
Maybe it was the
Laracast's Behat module?
default:
extensions:
Laracasts\Behat: ~
Behat\MinkExtension:
default_session: laravel
laravel: ~
and here's my .env.behat
APP_ENV=acceptance
APP_DEBUG=true
DB_DEFAULT=sqlite
#HTH
On Thu, Jun 4, 2015 at 9:32 AM, Jace Ju [email protected] wrote:
Here is solution:
Update your behat.yml:
default: extensions: Laracasts\Behat\ServiceContainer\LaravelExtension: env_path: .env.behat Behat\MinkExtension\ServiceContainer\MinkExtension: default_session: laravel base_url: http://localhost:8000 laravel: ~
Run behat from vendor:
$ ./vendor/bin/behat -dl
— Reply to this email directly or view it on GitHub https://github.com/laracasts/Behat-Laravel-Extension-Example-App/issues/1#issuecomment-108784764 .
@jaceju With your config I'm still getting:
[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
`Laracasts\Behat\ServiceContainer\LaravelExtension` extension file or class could not be located.
@dancourse It seems to work with you config setup! :astonished: Thanks!
@nWidart There is my full steps of installation:
$ git clone https://github.com/laracasts/Behat-Laravel-Extension-Example-App.git behat-laravel-example
$ cd behat-laravel-example
$ composer install
$ composer show -i
behat/behat dev-master 58bae29 Scenario-oriented BDD framework for PHP...
behat/gherkin dev-master 9c8fcf2 Gherkin DSL parser for PHP 5.3
behat/mink dev-master 5ca64b6 Browser controller/emulator abstraction...
behat/mink-browserkit-driver dev-master 896e8a8 Symfony2 BrowserKit driver for Mink fra...
behat/mink-extension dev-master 2ab8c00 Mink extension for Behat
behat/transliterator dev-master 2fd406d String transliterator
....
It would throw an exception when I run behat
without any modifications:
$ ./vendor/bin/behat
[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
`Laracasts\Behat` extension file or class could not be located.
But it works with my solution.
I don't know what is the difference between @dancourse's solution and mine, just FYI.
I also had to run ./vendor/bin/behat. I created an alias in my vm. You can simply add the line alias behat='./vendor/bin/behat'
to your .bashrc
file. Then restart your shell and run behat on its own.
same issue. i understand this may be a user error, but it seems to be fairly constant.
running behat relative to my install worked after several hours of perusing the Behat documentation.
Depending the versions you use, the config can diff. The \ServiceContainer\LaravelExtension can be excluded or not, depending the version. Idem for the other config. After execute: composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension --dev
This happened:
- Removing behat/mink-extension (dev-master 2ab8c00)
- Installing behat/mink-extension (v2.2) Loading from cache
- Removing laracasts/behat-laravel-extension (dev-master b02c1c1)
- Installing laracasts/behat-laravel-extension (1.0)
And now I can use the original behat.yml.