Giter Club home page Giter Club logo

behat-laravel-extension's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

behat-laravel-extension's Issues

Call to undefined method Selenium2Driver::reboot

Call to undefined method Behat\Mink\Driver\Selenium2Driver::reboot() in /Users/dimitar/sites/najdiprevoz.dev/vendor/laracasts/behat-laravel-extension/src/Context/KernelAwareInitializer.php on line 78

I need selenium for javascript testing, and this is an error I'm getting.

Also, I have this check:

    /**
     * @Then I should be logged in
     */
    public function iShouldBeLoggedIn()
    {
        PHPUnit::assertTrue(Auth::check());
    }

And Auth::check() returns false, although I'm logged in (which i can see and test in the firefox window that selenium opens).

Feature:

Feature: sign in
  In order to use the full capability of the site
  As a visitor
  I need to be able to sign in

  @javascript
  Scenario: Sign in with facebook
    Given I am on the homepage
    And I click "Login"
    And I login with facebook
    Then I should be logged in

FeatureContext.php

<?php

use Behat\Behat\Tester\Exception\PendingException;
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;
use PHPUnit_Framework_Assert as PHPUnit;

/**
 * Defines application features from the specific context.
 */
class FeatureContext extends MinkContext implements Context, SnippetAcceptingContext
{
    /**
     * Initializes context.
     *
     * Every scenario gets its own context instance.
     * You can also pass arbitrary arguments to the
     * context constructor through behat.yml.
     */
    public function __construct()
    {
    }

    /**
     * @Then I should be logged in
     */
    public function iShouldBeLoggedIn()
    {
        PHPUnit::assertTrue(Auth::check());
    }

    /**
     * @Given I click :arg1
     */
    public function iClick($arg1)
    {
        $this->clickLink($arg1);
    }

    /**
     * @Given /^I login with facebook$/
     */
    public function iLoginWithFacebook()
    {
        $this->fillField('email', 'facebookEmailt');
        $this->fillField('pass', 'password');
        $this->pressButton('login');
        if ($this->getSession()->getPage()->findButton('__CONFIRM__')) {
            $this->pressButton('__CONFIRM__');
        }
    }
}

behat.yml

default:
  extensions:
    Laracasts\Behat: ~
    Behat\MinkExtension:
      show_cmd: firefox %s
      default_session: laravel
      base_url: http://najdiprevoz.dev
      laravel: ~
      sessions:
        javascript:
          selenium2:

Call to undefined method FeatureContext::getSession() if not extending MinkContext

The documentation makes it sound as if extending Behat\MinkExtension\Context\MinkContext is optional, however without it, I get this error:

PHP Fatal error:  Call to undefined method MyApp\FeatureContext::getSession() in ./vendor/laracasts/behat-laravel-extension/src/Context/KernelAwareInitializer.php on line 78
Stack trace:
#1. {main}() ./vendor/behat/behat/bin/behat:0
#2. Symfony\Component\Console\Application->run() ./vendor/behat/behat/bin/behat:31
#3. Behat\Testwork\Cli\Application->doRun() ./vendor/symfony/console/Symfony/Component/Console/Application.php:126
#4. Symfony\Component\Console\Application->doRun() ./vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:102
#5. Symfony\Component\Console\Application->doRunCommand() ./vendor/symfony/console/Symfony/Component/Console/Application.php:195
#6. Symfony\Component\Console\Command\Command->run() ./vendor/symfony/console/Symfony/Component/Console/Application.php:874
#7. Behat\Testwork\Cli\Command->execute() ./vendor/symfony/console/Symfony/Component/Console/Command/Command.php:253
#8. Behat\Testwork\Tester\Cli\ExerciseController->execute() ./vendor/behat/behat/src/Behat/Testwork/Cli/Command.php:63
#9. Behat\Testwork\Tester\Cli\ExerciseController->testSpecifications() ./vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php:108
#10. Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise->test() ./vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php:146
#11. Behat\Testwork\Tester\Runtime\RuntimeExercise->test() ./vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php:70
#12. Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester->test() ./vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php:71
#13. Behat\Testwork\Hook\Tester\HookableSuiteTester->test() ./vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php:72
#14. Behat\Testwork\Tester\Runtime\RuntimeSuiteTester->test() ./vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php:73
#15. Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester->test() ./vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php:63
#16. Behat\Behat\Hook\Tester\HookableFeatureTester->test() ./vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php:71
#17. Behat\Behat\Tester\Runtime\RuntimeFeatureTester->test() ./vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php:72
#18. Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester->tearDown() ./vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php:84
#19. Behat\Testwork\EventDispatcher\TestworkEventDispatcher->dispatch() ./vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php:117
#20. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() ./vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php:39
#21. call_user_func:{./vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164}() ./vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
#22. Laracasts\Behat\Context\KernelAwareInitializer->rebootKernel() ./vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164

PHP Fatal error:  Uncaught exception 'Illuminate\Container\BindingResolutionException' with message 'Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable.' in ./vendor/laravel/framework/src/Illuminate/Container/Container.php:785
Stack trace:
#0 ./vendor/laravel/framework/src/Illuminate/Container/Container.php(656): Illuminate\Container\Container->build('Illuminate\\Cont...', Array)
#1 ./vendor/laravel/framework/src/Illuminate/Foundation/Application.php(613): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#2 ./vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(151): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#3 ./vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(73): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler()
#4 /home/hackel/d in ./vendor/laravel/framework/src/Illuminate/Container/Container.php on line 785

Of course I do plan to use MinkContext, I just thought I would point out this current discrepancy.

Use with Laravel 4

Can I use this with Laravel 4?
I'm getting the error [RuntimeException] Could not locate the path to the Laravel bootstrap file.

Is there any way to solve this?

Mink base_url param causes fail

When using the base_url param in the behat.yml file, every scenario after the first one fails. This is caused because the laracasts extension isn't rebooting with the baseUrl, like it is when it starts up the first time.

Behat/MinkExtension#196

I tried fixing it myself, with no luck 😞

failed to open stream: Permission denied

Warning: require(C:\websites\mysite.com\app): failed to open stream: Permission denied in C:\websites\mysite.com\vendor\behat\behat\src\Behat\Testwork\ServiceContaine
r\ExtensionManager.php on line 172

...
PHP Fatal error:  require(): Failed opening required 'App'

This error appears when I try to run:

behat --append-snippets

Some Info:

  • Windows 7
  • Command Prompt
  • Laravel 5
  • I've tried changing App folder permissions to 0755
  • I've tried running CMD as administrator

Any ideas?
Could it be the require paths in behat need OS specific separators?

Use for Laravel5 Package Development

Hi,
I'm trying to use the Behat-Laravel-Extension for Package Development (Laravel 5),
but when I try to run behat I'm receiving the error
"Could not locate the path to the Laravel bootstrap file."
(because the bootstrap file is searched in my packages folder, where it can't be found of course).

Is there a way to adapt Behat-Laravel-Extension to Package Development?

Accessing the Application

Hoe can i access the laravel Application from inside a context? Also my sessions+cookies are not cleared between tests while i have this in my @beforeScenario

        $this->getSession()->stop();
        //Clear cache and sessions for before each test
        exec('git clean -fxd ' . storage_path('framework/cache'));
        exec('git clean -fxd ' . storage_path('framework/sessions'));
        exec('redis-cli flushall');

Model events are only triggered once

If I have a feature with a single scenario that triggers model events (saving) everything is good.

If I run this feature with other tests or have few scenarios in the same feature - only the first one triggers the model event, rest are ignored.

Example (always works if only this feature file is called):

Scenario: paid invoice does have enough payments
    Given I have a "paid" invoice
    When I remove payments so that the total is not covered
    Then invoices totals should match isPaid field value   

Example 2 (first scenario works, second does not):

Scenario: unpaid invoice does not have enough payments
   Given I have an "unpaid" invoice
   When I add payments so that the total is covered
   Then invoices totals should match isPaid field value

Scenario: paid invoice does have enough payments
   Given I have a "paid" invoice
   When I remove payments so that the total is not covered
   Then invoices totals should match isPaid field value   

Example 3 (same as 2 but switched - still first works, second does not):

Scenario: paid invoice does have enough payments
   Given I have a "paid" invoice
   When I remove payments so that the total is not covered
   Then invoices totals should match isPaid field value   

Scenario: unpaid invoice does not have enough payments
   Given I have an "unpaid" invoice
   When I add payments so that the total is covered
   Then invoices totals should match isPaid field value

Could not find package laracasts/behat-laravel-extension

I ran the command according to the readme but it couldn't find behat-laravel-extension. I am new to Laravel so this could easily be a problem existing between keyboard and chair. Mac OS 10.10.1 Yosemite, php 5.5.14.

composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension --dev

Using version ~3.0 for behat/behat
Using version ~1.6 for behat/mink
Using version ~2.0 for behat/mink-extension



  [InvalidArgumentException]                                                                                                                           
  Could not find package laracasts/behat-laravel-extension at any version for your minimum-stability (stable). Check the package spelling or your min  
  imum-stability                                                                                                                                       



require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [packages1] ... [packagesN]

Doesn't work with Laravel v5.1.43

Laravel base installation... nothing modified. Literally just added this library and it gives the error:

Whoops, looks like something went wrong.

Laravel 5.5 no longer works

Can anyone help in resolving that problem?

the MinkExtenstion seems to be updated and the package no longer works

I currently use

default:
    extensions:
        Behat\MinkExtension:
            base_url:  'http://localhost/tdl/public'
            sessions:
              default:
                goutte: ~

But once I added the laravel related estenstion

        Laracasts\Behat:

the following error appear when I run the features test

In RemoveUnusedDefinitionsPass.php line 75:
                                             
  Serialization of 'Closure' is not allowed  

Any help?

UploadedFile is invalid

Hi,
I am not sure if this is a right place to ask about it but when trying to test file upload I am getting an validation failure when Illuminate\Validation\Validator::validateAttribute is called.
I have an FormRequest with rules as follow:

return [
    'name' => [
        'required',
        'max:100',
    ],
    'images.*' => [
        mimes:jpeg,png,jpg,gif,svg.
        max:2048'
    ],
    'description' => 'max:256',
];

I traced the problem to the Symfony\Component\HttpFoundation\File\UploadedFile::isValid function which return false. It class have an option to set an UploadedFile to test mode but it seems that the test flag is not preserve from my FeatureContext.
I am using UploadedFile::fake()->image('test.png') to generate a test image with a test flag but the flag is not preserve when the request is made.

How to use ipv4 in guzzlehttp/guzzle": "^6.2

exception 'GuzzleHttp\Exception\ConnectException' with message 'cURL error 7: Failed to connect to -----ipv6-------- Network is unreachable (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

How do I use ipv4 guzzle 6.2?
How is the default for all connections ipv4?

Twitter API with socialite login test fails (Route Not Found Exception)

hi
I am writes feature tests with behat , mink and laravel . to auto authenticate laravel user with twitter api .
when I run the feature scenario . I get

NotFoundHttpException

this is my feature test

Feature: User Can Register And Login With Multiple Social Accounts
  In order to login easly and publish posts to social network
  As visitor
  I Want to register and login to the site with social account

  Social accounts:
    - Twitter
    - Facebook
    - google
    - linkedin
    - instagram
    - pinterest

  Scenario: Login And Register User With Twitter Successfully
    Given I am on homepage
    When I request login with twitter
    Then I should have associated social account with my username
    And I should be logged in to my time line page

and this the failing step definition

    /**
     * @When I request login with twitter
     */
    public function iRequestLoginWithTwitter()
    {
        $this->clickLink('twitter');
        $this->assertUrlRegExp('@/oauth/authenticate@');
        $this->showLastResponse();
        $this->assertElementContains('submit','Authorize app');
    }

next is the error page screen shot

screencapture-file

when I use the normal manual process it is opens the page . and I see the button 'Authorize app' button

can any one help me with this ?

Use name convention for extension registration

In Behat 3 you don't need to provide a full extension classname when you're registering extensions, you can use a shorter version and Behat will guess the rest (if you follow naming convention, of course):
https://github.com/Behat/Behat/blob/master/src/Behat/Testwork/ServiceContainer/ExtensionManager.php#L116-L129

Because of that line, if your extension class name looks like {YourOrg}\{YourName}Extension\ServiceContainer\{YourName}Extension, then you can simply use {YourOrg}\{YourName}Extension as an extension name in behat.yml. For example instead of:

default:
    extensions:
        Behat\MinkExtension\ServiceContainer\MinkExtension: ~

you could say:

default:
    extensions:
        Behat\MinkExtension: ~

So if you rename your Laracasts\Behat\ServiceContainer\LaravelExtension class to Laracasts\Behat\ServiceContainer\BehatExtension, then people would be able to register your extension with just:

default:
    extensions:
        Laracasts\Behat: ~

Provide context argument resolver in addition to *AwareContext

KernelAwareContext injects entire application into your context, which in most cases is not what you want. You'd usually want couple of services injected into the context constructor instead of the entire container.

Behat 3 has the extension point called context ArgumentResolver:
https://github.com/Behat/Behat/blob/master/src/Behat/Behat/Context/Argument/ArgumentResolver.php

By implementing this extension point you could hook Behat into Laravel, so that it would automatically inject services from the container using the argument typehints, for example. Here's how we do it in Symfony extension:
https://github.com/Behat/Symfony2Extension/blob/master/src/Behat/Symfony2Extension/Context/Argument/ServiceArgumentResolver.php

Method put nog working

Hi Jeff,

I've noticed that all my forms that post with the _method PUT are handled as normal POST requests and won't hit $router->put. I've got the same tests setup with Codeception and thats working just fine.

Do you have any idea how this is possible?

Kind regards,

Rogier

Exception: Class could not be loaded

I've watched the video on Laracasts, tried the code listed in README for this extension, and played around with various different incantations of including the extensions but nothing works. No matter what I do it always comes up with the below error when I run behat:

[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]                     
`Laracasts\Behat\ServiceContainer\BehatExtension` extension file or class could not be located.

First attempt from my behat.yml based on the video:

  extensions:
    Laracasts\Behat\ServiceContainer\LaracastsExtension: ~
    Behat\MinkExtension\ServiceContainer\MinkExtension:
        default_session: laravel
        laravel: ~

Second attempt, based on discovering the class name had changed and the comments:

  extensions:
    Laracasts\Behat\ServiceContainer\BehatExtension: ~
    Behat\MinkExtension\ServiceContainer\MinkExtension:
        default_session: laravel
        laravel: ~

Third attempt based on what the repository says:

default:
    extensions:
        Laracasts\Behat:
            # env_path: .env.behat
        Behat\MinkExtension:
            default_session: laravel
            laravel: ~

Am I missing something here? Fatal errors every time.

(Oh the stinging irony in wanting to test but not being able to get the test runner to run. Ha!)

cURL error 6: Could not resolve host: http (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (GuzzleHttp\Exception\ConnectException)

I tried Installing it on Laravel 5.3
here is my composer.json file

"require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*",
        "guzzlehttp/guzzle": "^6.2"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.0",
        "symfony/css-selector": "3.1.*",
        "symfony/dom-crawler": "3.1.*",
        "barryvdh/laravel-ide-helper": "^2.2",
        "behat/behat": "^3.1",
        "behat/mink": "^1.7",
        "behat/mink-extension": "^2.2",
        "laracasts/behat-laravel-extension": "^1.0",
        "doctrine/dbal": "^2.5"
    },

And Im Just Testing Mail Trap

public function whenTheReportIsDoneTheUserWillGetAnEmailToLetThemKnowItIsDone()
    {
        $lastEmail = $this->fetchInbox()[0];
    }

and It Always Throw me this error

 cURL error 6: Could not resolve host: http (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (GuzzleHttp\Exception\ConnectException)

Can Anyone Tag me the Real Fix for this ? So I can just have it merge on my End...
Thanks

Broken forms – values filled in from former scenarios

I have been researching this for some hours now and I'm stuck. I'm working with laravel 5.3. Other specs are listed below.

Calling $this->visit(route('customer.add')) returns cached page content, which is very bad when you try to test UI behavior for missing mandatory fields.

This is true for scenarios as well as outlines (example tables for scenarios). The second scenario dumps page content for filled in fields of the former scenarios although nothing has been saved.

To be clear about that behavior:
With behat: I visit the form. I fill in the field, hit submit, that produces an error. The model is not saved. An error message is shown. I switch the page. Then I visit the form again. I see the last state of the form with the filled in field instead of an empty form. This includes the error message.

This behavior differs from my manual tests, where I get an empty form as expected.

I would expect $this->visit(route('myroute')) to return an empty form (which is only true for the very first scenario). But it seems to take whatever it had before.

Also tried to force reloading with $this->visit('/customer/edit?ts='.random_bytes(20)) – without success. I've added the following line to my template {{ isset($_GET['ts'])?$_GET['ts']:'x' }} just to make sure, there's no other error-source, but the output is always x when using behat (so the tsparameter is not passed). However, manual tests of course show the passed parameter value instead.

In my template, I'm using the Form facade (Collective\Html\FormFacade) like so:

{!! Form::model($customer, ['route' => 'customer.store']) !!}
{!! Form::label('first_name', 'First name:') !!}
 {!! Form::text('first_name') !!}
 {!! Form::label('last_name', 'Last name:') !!}
 {!! Form::text('last_name') !!}
{!! Form::close() !!}

Example:
I have two scenarios.

The first one:

  • visits page1

Result:

<label for="first_name">First name:</label>
<input name="first_name" type="text" id="first_name">

Then the first one:

  • fills in first_name with "Thomas"
  • hits submit (effectively shows an error message and doesn't save the model)
  • changes to page2

The second scenario:

  • visits page1

Result:

<label for="first_name">First name:</label>
<input name="first_name" type="text" value="Thomas" id="first_name">

BTW: This also is true when dealing with one scenario only:

  • Visit page1
  • Fill in a field
  • Submit with error
  • Visit page2
  • Visit page1
    -> Field is filled in. But it shouldn't be.

Also tried all of the options below, in all combinations:

/**
     * @AfterScenario
     */
    public function clearCache()
    {
        // clear compiled templates, otherwise you get forms with filled fields from former scenarios.
        //Artisan::call('view:clear');
        //Artisan::call('cache:clear');
        Cache::flush();
    }

BTW: I've also seen this pull request: #6

I'm stuck and I would very much appreciate any help from the great laravel community. Thanks in advance.

My routes:

Route::get('/customer/edit', 'CustomerController@add')->name('customer.add');
Route::put('/customer', 'CustomerController@store')->name('customer.store');

My .env.behat contains

CACHE_DRIVER=array
SESSION_DRIVER=array

My behat.yml

default:
    extensions:
        Laracasts\Behat:
            env_path: .env.behat
        Behat\MinkExtension:
            default_session: laravel
            laravel: ~
    suites:
        domain:
          contexts:
            - DomainContext
        ui:
          contexts:
            - UIContext

My composer.json

"behat/behat": "^3.1",
"behat/mink": "^1.7",
"behat/mink-extension": "^2.2",
"laracasts/behat-laravel-extension": "^1.0"

Does ANYBODY have this working with L5, PHPUnit

I am pulling what hair I have left trying to get this working.

I can create a fresh L5 installation and get Behat working with this extension, but PHPUnit wont work. To fix PHPUnit, I must first call 'composer dump-autoload' which makes PHPUnit happy.

BUT, now Behat wont work and I cant get it working after that, receiving the infamous :

exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum function nesting level of '100' reached, aborting!' in /Users/mikee/Documents/Projects/l5-b3/vendor/composer/ClassLoader.php:347 Stack trace: #0 /Users/mikee/Documents/Projects/l5-b3/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(116): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalExceptionFromError(Array) #1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() #2 {main}

Then, if I remove the extended MinkContext from the FeatureContext file, the test sort of works but since I am using something from MinkContext

Scenario: Home Page
Given I am on the homepage
Then I should see "Laravel 5"

Not compatible with Laravel 5.6

Getting the following error

In RemoveUnusedDefinitionsPass.php line 75:
                                             
  Serialization of 'Closure' is not allowed  

Similar to #72, it won't work with Laravel 5.6 as it now pulls in Symfony 4 components and has a requirement for symfony/dependency-injection (^4.1) meaning downgrading to symfony/dependency-injection:"3.*" will no longer work.

Configuration issues

How do you config this package in Laravel 5.5 with the latest versions of Behat & Mink?

My behat.yml config is as follows after watching the Laracast video. I've updated the extensions to match what they appear to be in the relevant vendor folders.

#behat.yml
default:
    extensions:
        Laracasts\Behat\ServiceContainer\BehatExtension:
            env_path: .env.behat
        Behat\MinkExtension\ServiceContainer\MinkExtension:
            default_session: laravel
            base_url: http://localhost:8000
            laravel: ~

However, when I run behat it appears to crash out with no logging and just gives me the scenario. If I remove the APP_KEY from my config the behat tests appear to run but I get an error in my laravel logs.

Any suggestions would be appreciated @JeffreyWay.

Looking at the mink extension behat.yml would suggest that the config should be more like

default:
  suites:
    default:
      path: %paths.base%/features
      contexts: [Behat\MinkExtension\Context\MinkContext]
  extensions:
    Laracasts\Behat\ServiceContainer\BehatExtension:
        env_path: .env.behat
    Behat\MinkExtension:
      base_url: http://en.wikipedia.org/
      sessions:
        default:
          laravel: ~

CSRF token empty when using this extension

We're trying to use this extension to test our application but are finding that then CRSF tokens put into forms with csrf_field () are empty. When using the application normally through a web browser the tokens are included in the form and work correctly. However, when running a Behat test and dumping the page output I can see that we just get <input name="_token" type="hidden"> (i.e. it contains no value).

In my attempts to debug it does seem that a token is getting generated since Illuminate\Session\Store::regenerateToken() is being called. However, it seems that the session store object that first generates the CSRF token and the one that is subsequently asked for it in the form as different objects — see output below from a var_dump in both Collective\Html\FormBuilder::token() (which we're using to build our forms) and Illuminate\Session\Store::regenerateToken(). You can see that the spl_object_hash values are different so I can only assume that the token is getting lost between the two instances of Illuminate\Session\Store.

How are CSRF tokens supposed to be stored? If it's in the Laravel session, should this extension be able to cope with that and use a persistent session? If not, is there anything obvious that I need to change.

array(4) {
  [0]=>
  string(51) "★★★ Illuminate\Session\Store::regenerateToken"
  ["session class"]=>
  string(24) "Illuminate\Session\Store"
  ["spl_object_hash"]=>
  string(32) "000000001223f2a1000000001315d23b"
  ["current result of Illuminate\Session\Store::getToken()"]=>
  string(40) "1mRtRhUV3ZZifXHIZmzxYIqFrzDzqDyHqnsyZPEl"
}
array(4) {
  [0]=>
  string(44) "★★★ Collective\Html\FormBuilder::token"
  ["session class"]=>
  string(24) "Illuminate\Session\Store"
  ["session object hash"]=>
  string(32) "000000001223f215000000001315d23b"
  ["current result of Illuminate\Session\Store::getToken()"]=>
  NULL
}

Installation issue with official release of Laravel 5

I got the following issue while installing laracasts/behat-laravel-extension with the newly released Laravel 5.

I was trying to follow this laracast:

https://laracasts.com/lessons/laravel-5-and-behat-bffs

And I got the some prophecy version error.

I was able to install behat/behat, behat/mink, behat/mink-extension first, but when trying laracasts/behat-laravel-extension after that, the same errors showed up again. Error messages are at the bottom of this comment.

I wonder if there's a simple answer to that. If not, I'd love to explore a solution by myself, if someone could kindly give me a pointer to start with.

Thanks!

H. Guo

php composer.phar require laracasts/behat-laravel-extension

Using version dev-master for laracasts/behat-laravel-extension./composer.json has been updated
Loading composer repositories with package information Updating dependencies (including require-dev)

[RuntimeException]

Could not load package phpspec/prophecy in http://packagist.org: [UnexpectedValueException] Could not parse version constraint ^1.0.2: Invalid version string "^1.0.2"

[UnexpectedValueException]
Could not parse version constraint ^1.0.2: Invalid version string "^1.0.2"

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [packages1] ... [packagesN]

Composer: cannot install Laravel-Behat-Extension on Laravel 5.2

I'm following the tutorial about Behat and BDD but I ran into problems with behat, mink and mink-extension.

Creating the new project with (composer create-project laravel/laravel behat-learning) worked for me.

Then I ran into errors with behat, mink and mink-extension and the only solution I found was to use their dev-master branches (composer require behat/behat:dev-master behat/mink:dev-master behat/mink-extension:dev-master --dev). It worked and as I don't mind using those branches, everything good on my side.

But when I try to install behat-laravel-extension then I got this problem and I am stuck:

Your requirements could not be resolved to an installable set of packages.

Problem 1
  - Installation request for laracasts/behat-laravel-extension ^1.0 -> satisfiable by laracasts/behat-laravel-extension[1.0].
  - Conclusion: remove symfony/dom-crawler v3.0.1
  - Conclusion: don't install symfony/dom-crawler v3.0.1
  - laracasts/behat-laravel-extension 1.0 requires behat/mink-browserkit-driver ~1.2 -> satisfiable by behat/mink-browserkit-driver[v1.2.0, v1.3.0].
  - behat/mink-browserkit-driver v1.2.0 requires symfony/dom-crawler ~2.0 -> satisfiable by symfony/dom-crawler[v2.8.0, v2.8.1].
  - behat/mink-browserkit-driver v1.3.0 requires symfony/dom-crawler ~2.3 -> satisfiable by symfony/dom-crawler[v2.8.0, v2.8.1].
  - Can only install one of: symfony/dom-crawler[v2.8.0, v3.0.1].
  - Can only install one of: symfony/dom-crawler[v2.8.1, v3.0.1].
  - Installation request for symfony/dom-crawler == 3.0.1.0 -> satisfiable by symfony/dom-crawler[v3.0.1].

It looks like it's about the package itself that's why I'm asking here.

Database transactions

I looks like database transactions don't work when using mysql.
I dont know if this is because of laravel 5 latest changes or not.

.env.behat is read but variables aren't accessible

My laravel version = 5.4
and my composer.json:
`"barryvdh/laravel-ide-helper": "^2.3",

    "behat/behat": "^3.4",

    "behat/mink": "^1.7",

    "behat/mink-extension": "^2.3",

    "fzaninotto/faker": "~1.4",

    "laracasts/behat-laravel-extension": "^1.1",`

I removed APP_ENV from .env and set APP_ENV=behat in .env.behat
When I echo environment:
echo app()->environment() ----> local
And environment variables can not be used by env() and this method always returns null for everything.
But! If I echo loaded env file:
echo app()->environmentFile() ---> .env.behat

What should I do?

Application state not refreshed between scenarios

The application instance is not refreshed and so singleton services are being reused during different scenarios. This can be a problem if the singelton has some for of state. How can i refresh the application completely on each scenario?

Behat only running 1st Scenario

Hi there,

I'm using this to begin to test an API that I am working on. My .feature has several Scenarios in but Behat is only running the first one for some reason. Would you have any clue as to why?

My behat.yml file

default:
    extensions:
        Laracasts\Behat:
            env_path: .env.behat
        Behat\MinkExtension:
            base_url: http://localhost:8080
            default_session: laravel
            laravel: ~

    gherkin:
        filters:
            tags: ~@skip

    suites:
        default:
            paths: [ %paths.base%/tests/Feature ]
            contexts:
                - Tests\Feature\Context\APIClientContext:
                - Tests\Feature\Context\BusinessContext:
                - Tests\Feature\Context\FeatureContext:

Let me know if you need any more info.

Cipher issue

Had an problem with APP_KEY not getting passed to here

vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:37

Need to make sure it is not regression in my behat library

screenshot 2016-09-11 17 15 53

My fix for now was to add

default:
    extensions:
        Laracasts\Behat:
            env_path: .env
        Behat\MinkExtension:
            base_url: https://teamdocs-leanpub.dev
            default_session: laravel
            laravel: ~
            selenium2:
              wd_host: "http://selenium-server.dev:4444/wd/hub"
            browser_name: chrome

env_path: .env
instead of leaving it commented out?

Was there are regression somewhere on this?

Mailtrap trait error with Guzzle 6

For the past hour or so Ive been wrestling with why my previously working tests were all of a sudden failing. I hadn't realised that during a previous composer update Guzzle had upgrade to version 6. Using 6 i get the following error when trying to use the Mailtrap trait...

cURL error 3: malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (GuzzleHttp\Exception\RequestException)

Downgrading to Guzzle 5 meant this worked correctly. Not sure what the root cause is here, but it was a painful bug to figure out (for me anyway) so want to alert anyone who may run into the same issue. Might be worth looking into fixing or requiring version 5?

Keep up the good work Jeffrey :)

Dependency Injection

Hi,
Is it possible to use dependency injection in Context classes?
Phpstorm's behat integration can't find facades and complaints about them.
I have used constructor parameters with behat.yml file but looks like it just works with plains strings.

Set "show_cmd" parameter in behat.yml ... basic setup does not work

Hi all

I am currently stuck while running behat with laravel. The error is happening on ->visit function.

Mink maybe does not get some default option to be able to open the page without a custom driver. These set up always used to work and I am wondering what configuration to use since I would like to use a built in way just like laravel extension promises, without selenium goutte etc.

When i run behat i get

Feature: Laravel 5 page
  As a behat tester
  In order use behat mink correctly
  I want to see the homepage to make sure visit does not throw a show_cmd exception

  Scenario: Laravel startup page displaying correctly # features/example.feature:6
    Given I am on the homepage                        # FeatureContext::iAmOnHomepage()
    Then show last response                           # FeatureContext::showLastResponse()
      Set "show_cmd" parameter in behat.yml to be able to open page in browser (ex.: "show_cmd: firefox %s") (RuntimeException)
    Then I should see "Laravel 5"                     # FeatureContext::assertPageContainsText()

--- Failed scenarios:

    features/example.feature:6

1 scenario (1 failed)
3 steps (1 passed, 1 failed, 1 skipped)

I have created a repo with a docker-compose setup and instructions on how to reproduce in details at https://github.com/bizmate/behat_show_cmd

Also i have tested without goutte: ~ but i still need the show_cmd or it will not work

for instance with

Behat\MinkExtension:
      default_session: laravel
      laravel: ~

Am I missing anything? If you are on linux u can run it fast and check with docker-compose up

Modifying authenticated user and persistence of the flash messages

While working with Behat and the Laravel Extension I have encountered the following issues:

  1. After we modify the authenticated user the changes are not visible until the user relogs. That’s probably due to requests, which are made using the same instance of the application. If the user is signed in, it's stored in the memory to the end of a scenario.

    https://github.com/laravel/framework/blob/5.0/src/Illuminate/Auth/Guard.php#L134-L137

  2. The flash messages are persistent. They should disappear after page’s reload but that doesn’t happen.

I have created a repository with exemplary tests, which show above mentioned issues.

https://github.com/tmalecki/l5-behat-test

Thanks.

Behat returns the wrong view in Laravel 5.1

I'm unsure if this issue is caused by my own error, Behat itself, or this extension. However, I've seen some others posting about this as well so I thought I'd share.

Using this scenario:

Scenario: Home Page
Given I am on the homepage
Then I should see "Laravel 5"

The view I'm using is the default Laravel 5.1 welcome view and does not contain Yahoo! as demonstrated in the response below.

I call $this->printLastResponse() within assertPageContainsText($text)

printLastResponse() returns:

http://localhost/

 <!DOCTYPE html>
 <html>
     <head>
             <meta charset="UTF-8" />
             <meta name="robots" content="noindex,nofollow" />
             <style>
                     /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
                     html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}

                     html { background: #eee; padding: 10px }
                     img { border: 0; }
                     #sf-resetcontent { width:970px; margin:0 auto; }
                                 .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
                     .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
                     .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
                     .sf-reset .clear_fix { display:inline-block; }
                     .sf-reset * html .clear_fix { height:1%; }
                     .sf-reset .clear_fix { display:block; }
                     .sf-reset, .sf-reset .block { margin: auto }
                     .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
                     .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
                     .sf-reset strong { font-weight:bold; }
                     .sf-reset a { color:#6c6159; cursor: default; }
                     .sf-reset a img { border:none; }
                     .sf-reset a:hover { text-decoration:underline; }
                     .sf-reset em { font-style:italic; }
                     .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
                     .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
                     .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
                     .sf-reset .exception_message { margin-left: 3em; display: block; }
                     .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
                     .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
                             -webkit-border-bottom-right-radius: 16px;
                             -webkit-border-bottom-left-radius: 16px;
                             -moz-border-radius-bottomright: 16px;
                             -moz-border-radius-bottomleft: 16px;
                             border-bottom-right-radius: 16px;
                             border-bottom-left-radius: 16px;
                             border-bottom:1px solid #ccc;
                             border-right:1px solid #ccc;
                             border-left:1px solid #ccc;
                         }
                     .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
                             -webkit-border-top-left-radius: 16px;
                             -webkit-border-top-right-radius: 16px;
                             -moz-border-radius-topleft: 16px;
                             -moz-border-radius-topright: 16px;
                             border-top-left-radius: 16px;
                             border-top-right-radius: 16px;
                             border-top:1px solid #ccc;
                             border-right:1px solid #ccc;
                             border-left:1px solid #ccc;
                             overflow: hidden;
                             word-wrap: break-word;
                         }
                     .sf-reset a { background:none; color:#868686; text-decoration:none; }
                     .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
                     .sf-reset ol { padding: 10px 0; }
                     .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
                             -webkit-border-radius: 10px;
                             -moz-border-radius: 10px;
                             border-radius: 10px;
                             border: 1px solid #ccc;
                         }
                 </style>
         </head>
     <body>
                     <div id="sf-resetcontent" class="sf-reset">
                     <h1>Whoops, looks like something went wrong.</h1>

                 </div>
     </body>
 </html>

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

Please help!!!
I want to use Behat with Laravel and I have been following these steps here
https://semaphoreci.com/community/tutorials/getting-started-with-bdd-in-laravel
but in my own laravel project not the default "Laravel 5".

When I run

$ behat

I get error :

Feature:
  In order to prove that Behat works as intended
  We want to test the home page for a phrase
  Scenario: Root Test           # features/hometest.feature:5
    When I am on the homepage   # FeatureContext::iAmOnHomepage()

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

    Then I should see "Welcome" # FeatureContext::assertPageContainsText()
--- Failed scenarios:
    features/hometest.feature:5
1 scenario (1 failed)
2 steps (1 failed, 1 skipped)
0m0.04s (11.91Mb)

Commands that I user in root directory of my Laravel project are :

composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension --dev
sudo ln -s /home/vagrant/Code/bdd-setup/vendor/bin/behat /usr/local/bin/behat

behat --init

I have added extensions in my FeatureContext.php

class FeatureContext extends Behat\MinkExtension\Context\MinkContext
implements Context, SnippetAcceptingContext

cp .env .env.behat0

php -S localhost:8888 -t public

behat

Here are my files:

<?php

use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;


class FeatureContext extends Behat\MinkExtension\Context\MinkContext implements Context, SnippetAcceptingContext
{

    public function __construct()
    {
    }
}

_env.behat_

APP_ENV=local
APP_KEY=base64:I22b/3uOm+B/H793P8aWQ5CucfiCxoMZ/H3JG6aYoLo=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=sqlite


CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

_behat.yml_

default:
    extensions:
        Laracasts\Behat:
            # env_path: .env.behat
        Behat\MinkExtension:
            default_session: laravel
            base_url: http://localhost:8888
            laravel: ~

And my composer.json requires are :

"name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*",
        "behat/behat": "^3.1",
        "behat/mink": "^1.7",
        "behat/mink-extension": "^2.2",
        "laracasts/behat-laravel-extension": "^1.0"
    },

Session store not set on request.

[2015-02-07 15:45:20] production.ERROR: exception 'RuntimeException' with message 'Session store not set on request.' in C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Http\Request.php:649
Stack trace:
#0 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Http\Request.php(442): Illuminate\Http\Request->session()
#1 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(210): Illuminate\Http\Request->old('email')
#2 C:\dev\git\lara\storage\framework\views\3a4206f31df478479bc3119bafe7f86f(18): Illuminate\Support\Facades\Facade::__callStatic('old', Array)
#3 C:\dev\git\lara\storage\framework\views\3a4206f31df478479bc3119bafe7f86f(18): Illuminate\Support\Facades\Input::old('email')
#4 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php(39): include('C:\\dev\\git\\lara...')
#5 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\Engines\CompilerEngine.php(57): Illuminate\View\Engines\PhpEngine->evaluatePath('C:\\dev\\git\\lara...', Array)
#6 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\View.php(136): Illuminate\View\Engines\CompilerEngine->get('C:\\dev\\git\\lara...', Array)
#7 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\View.php(104): Illuminate\View\View->getContents()
#8 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\View.php(78): Illuminate\View\View->renderContents()
#9 C:\dev\git\lara\storage\framework\views\e9cd4eef21e3baa395da517314b37a9b(121): Illuminate\View\View->render()
#10 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php(39): include('C:\\dev\\git\\lara...')
#11 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\Engines\CompilerEngine.php(57): Illuminate\View\Engines\PhpEngine->evaluatePath('C:\\dev\\git\\lara...', Array)
#12 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\View.php(136): Illuminate\View\Engines\CompilerEngine->get('C:\\dev\\git\\lara...', Array)
#13 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\View.php(104): Illuminate\View\View->getContents()
#14 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\View.php(78): Illuminate\View\View->renderContents()
#15 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Http\Response.php(44): Illuminate\View\View->render()
#16 C:\dev\git\lara\vendor\symfony\http-foundation\Symfony\Component\HttpFoundation\Response.php(202): Illuminate\Http\Response->setContent(Object(Illuminate\View\View))
#17 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Routing\Router.php(1185): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View))
#18 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Routing\Router.php(663): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View))
#19 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Routing\Router.php(618): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#20 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(157): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#21 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#22 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#23 C:\dev\git\lara\app\Http\Middleware\NotificationMarkRead.php(54): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(125): Strimoid\Http\Middleware\NotificationMarkRead->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 C:\dev\git\lara\app\Http\Middleware\RateLimit.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(125): Strimoid\Http\Middleware\RateLimit->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 C:\dev\git\lara\app\Http\Middleware\VerifyCsrfToken.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#28 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(125): Strimoid\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(55): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(125): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#31 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(61): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#32 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(125): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(36): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#34 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(125): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(40): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(125): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php(42): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#38 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(125): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#39 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#40 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(101): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#41 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(108): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#42 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(83): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#43 C:\dev\git\lara\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(664): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#44 C:\dev\git\lara\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\Client.php(81): Illuminate\Foundation\Application->handle(Object(Symfony\Component\HttpFoundation\Request))
#45 C:\dev\git\lara\vendor\symfony\browser-kit\Symfony\Component\BrowserKit\Client.php(327): Symfony\Component\HttpKernel\Client->doRequest(Object(Symfony\Component\HttpFoundation\Request))
#46 C:\dev\git\lara\vendor\behat\mink-browserkit-driver\src\BrowserKitDriver.php(147): Symfony\Component\BrowserKit\Client->request('GET', '/settings', Array, Array, Array)
#47 C:\dev\git\lara\vendor\behat\mink\src\Session.php(143): Behat\Mink\Driver\BrowserKitDriver->visit('/settings')
#48 C:\dev\git\lara\vendor\behat\mink-extension\src\Behat\MinkExtension\Context\RawMinkContext.php(131): Behat\Mink\Session->visit('/settings')
#49 C:\dev\git\lara\vendor\behat\mink-extension\src\Behat\MinkExtension\Context\MinkContext.php(43): Behat\MinkExtension\Context\RawMinkContext->visitPath('/settings')
#50 [internal function]: Behat\MinkExtension\Context\MinkContext->visit('/settings')
#51 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Call\Handler\RuntimeCallHandler.php(99): call_user_func_array(Array, Array)
#52 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Call\Handler\RuntimeCallHandler.php(54): Behat\Testwork\Call\Handler\RuntimeCallHandler->executeCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
#53 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Call\CallCenter.php(125): Behat\Testwork\Call\Handler\RuntimeCallHandler->handleCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
#54 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Call\CallCenter.php(80): Behat\Testwork\Call\CallCenter->handleCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
#55 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\Tester\Runtime\RuntimeStepTester.php(125): Behat\Testwork\Call\CallCenter->makeCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
#56 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\Tester\Runtime\RuntimeStepTester.php(73): Behat\Behat\Tester\Runtime\RuntimeStepTester->testDefinition(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\StepNode), Object(Behat\Behat\Definition\SearchResult), false)
#57 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\Hook\Tester\HookableStepTester.php(74): Behat\Behat\Tester\Runtime\RuntimeStepTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\StepNode), false)
#58 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\EventDispatcher\Tester\EventDispatchingStepTester.php(73): Behat\Behat\Hook\Tester\HookableStepTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\StepNode), false)
#59 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\Tester\StepContainerTester.php(59): Behat\Behat\EventDispatcher\Tester\EventDispatchingStepTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\StepNode), false)
#60 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\Tester\Runtime\RuntimeScenarioTester.php(76): Behat\Behat\Tester\StepContainerTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false)
#61 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\Hook\Tester\HookableScenarioTester.php(74): Behat\Behat\Tester\Runtime\RuntimeScenarioTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false)
#62 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester.php(103): Behat\Behat\Hook\Tester\HookableScenarioTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false)
#63 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\Tester\Runtime\RuntimeFeatureTester.php(83): Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false)
#64 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\Hook\Tester\HookableFeatureTester.php(72): Behat\Behat\Tester\Runtime\RuntimeFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
#65 C:\dev\git\lara\vendor\behat\behat\src\Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester.php(71): Behat\Behat\Hook\Tester\HookableFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
#66 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Tester\Runtime\RuntimeSuiteTester.php(63): Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
#67 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Hook\Tester\HookableSuiteTester.php(73): Behat\Testwork\Tester\Runtime\RuntimeSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
#68 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester.php(72): Behat\Testwork\Hook\Tester\HookableSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
#69 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Tester\Runtime\RuntimeExercise.php(71): Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
#70 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise.php(70): Behat\Testwork\Tester\Runtime\RuntimeExercise->test(Array, false)
#71 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Tester\Cli\ExerciseController.php(146): Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise->test(Array, false)
#72 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Tester\Cli\ExerciseController.php(108): Behat\Testwork\Tester\Cli\ExerciseController->testSpecifications(Object(Symfony\Component\Console\Input\ArgvInput), Array)
#73 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Cli\Command.php(63): Behat\Testwork\Tester\Cli\ExerciseController->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#74 C:\dev\git\lara\vendor\symfony\console\Symfony\Component\Console\Command\Command.php(253): Behat\Testwork\Cli\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#75 C:\dev\git\lara\vendor\symfony\console\Symfony\Component\Console\Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#76 C:\dev\git\lara\vendor\symfony\console\Symfony\Component\Console\Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Behat\Testwork\Cli\Command), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#77 C:\dev\git\lara\vendor\behat\behat\src\Behat\Testwork\Cli\Application.php(102): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#78 C:\dev\git\lara\vendor\symfony\console\Symfony\Component\Console\Application.php(126): Behat\Testwork\Cli\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#79 C:\dev\git\lara\vendor\behat\behat\bin\behat(31): Symfony\Component\Console\Application->run()

I have no idea what is going on. Request seems to lose its session in some moment. I am using L5, maybe that's cause of that problem?

[RuntimeException] Could not locate the path to the Laravel bootstrap file.

I followed the instructions here:

http://sangatpedas.com/20140219/installing-laravel-osx-mavericks/

Then installed Behat (making sure to update composer.json with "minimum-stability": "dev"):

https://github.com/laracasts/Behat-Laravel-Extension

composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension --dev

I created behat.yml at root level of project:

default:
    extensions:
        Laracasts\Behat:
            # env_path: .env.behat
        Behat\MinkExtension:
            default_session: laravel
            laravel: ~
    paths:
        features: features
        bootstrap: %behat.paths.features%/bootstrap

When I cd to root level of project and run:

vendor/bin/behat --init

I get:

[RuntimeException]                                        
Could not locate the path to the Laravel bootstrap file.  

I even tried updating behat.yml for 3:

http://stackoverflow.com/a/25626844

Still no luck. For the life of me I can't find any mention of "could not locate the path to the Laravel bootstrap file" on google. I'm on Mac OS 10.10.1 and php 5.5.14 thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.