apps4u's avatar

BEHAT

Ive not been able to get working Behat if I have composer set to this

"behat/behat": "~3.0@dev",
"behat/mink": "~1.6@dev",
"behat/mink-extension": "~2.0@dev",
"behat/mink-browserkit-driver": "~1.2@dev",
"laracasts/behat-laravel-extension": "dev-master"

Then I get this error

Feature: Testing In order to teach Behat As a teacher I want to demo how to install and create features

Scenario: Home Page # features/example.feature:6 Given 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 "Laravel 5" # FeatureContext::assertPageContainsText()

--- Failed scenarios:

features/example.feature:6

1 scenario (1 failed) 2 steps (1 failed, 1 skipped) 0m0.05s (13.02Mb)

If I have composer set to

"behat/behat": "~3.0",
"behat/mink": "~1.6",
"behat/mink-extension": "~2.0",
"behat/mink-browserkit-driver": "~1.2",
"laracasts/behat-laravel-extension": "dev-master"

Then I get a error saying

Feature: Testing In order to teach Behat As a teacher I want to demo how to install and create features

Scenario: Home Page # features/example.feature:6 PHP Fatal error: Call to a member function getSession() on a non-object in /Users/admin/PhpstormProjects/laravel-five/vendor/behat/mink-extension/src/Behat/MinkExtension/Context/RawMinkContext.php on line 101

0 likes
9 replies
apps4u's avatar

this is my Behat Yaml

default:
    extensions:
        Laracasts\Behat\ServiceContainer\BehatExtension: ~
        Behat\MinkExtension\ServiceContainer\MinkExtension:
            default_session: laravel
            base_url: http://localhost:8001
            laravel: ~
apps4u's avatar

can any one help Ive tried to get Behat up in running in both Laravel 4.2 and Larvel 5 . Ive never used beat before I followed the Laracasts example I keep getting the get_session called on none object error. If I try to use the behat and mink @dev packages I get a error saying the MinkExtension has not set Mink instance .

bobbybouwmann's avatar

Are you sure you have the correct namespace for the MinkExtension?

lihaibh's avatar

BTW does anybody know why I behat doesn't work when xdebug is active? Its annoying to deactivate it every time.

bobbybouwmann's avatar

I have xdebug activated and it works perfectly.. I think you have an error in your configuration!

lihaibh's avatar

No it works when I deactivate xdebug. What configurations shall I use?

harveydobson's avatar

I appreciate your comment is 6 years old. I read somewhere that if behat times out when using xdebug you need to increase the maximum nesting limit from the default, which i think is 100?

apps4u's avatar

thanks it working it turn out to be a file extension issue when creating a BeHat file the IDE i used create .yaml file extensions instead of .yml .

1 like

Please or to participate in this conversation.