Reputation: 55
My question is related with the tests for some application in Symfony2. I use the Behat and Mink to write the tests and I have some problems with tests for registration system.
I want to check the email after user submit the registration form and then follow the activation link in this email.
I found a short tutorial about the tests for emails:
http://docs.behat.org/cookbook/using_the_profiler_with_minkbundle.html
Solution in this tutorial works only if the "intercept_redirects" is set to "true" in configuration file for symfony but I already have some tests where I need to leave this variable with "false", so my question is... is it possible to change this value temporary, only for one test or do I have to change this value to "true" and then update all the tests?
How do you test your registration systems, and how do you write the tests for them ?
Upvotes: 2
Views: 1196
Reputation: 36201
Try using MinkRedirectContext from CommonContexts. It allows you to stop automatic redirections for a scenario and inspect the URL:
Given I do not follow redirects
When I ...
Then I should be redirected to "/thank-you"
You could also do it manually by calling followRedirects() yourself:
$this->getSession()->getDriver()->getClient()->followRedirects(false);
Upvotes: 1