Home » Php » php – Behat & Mink : Use the test environment

php – Behat & Mink : Use the test environment

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m current using Behat with Mink & Goutte Driver. When i’m trying to use it with my dev environment, via the app_dev.php file, which is a typical app_dev.php file from a Symfony2 Standard Edition, my tests are working just fine (Gists).

But, if I want to use a app_test file (which is the same as the app_dev file, except for the environment parameter set to “test” instead of “dev”, and debug mode disabled), on the logout scenario, it seems that Goutte can’t find the “user_signup” identifier, and in the “login” scenario, it does not find the “Root” text node. Indeed, when i’m using a print last response, it seems that the user is just not logged in : I still see the forms to log in an user…

When i’m on my dev environment (app_dev) or prod environment (app), everything seems to be working just fine though… Any idea ?

(If you think you need some other files, please tell me).

How to&Answers:

By default, Mink uses session called “symfony2”. That’s why you get different results accessing from browser and using Behat. You can change that in your behat.yml file. Check this doc for more info: http://extensions.behat.org/symfony2/index.html#symfony2-mink-session