You may have fixed the problem because I no longer have it (I use Behat v3.0.15, the BrowserKit 1.3. * Driver and Symfony v2.6.6).
I managed to reproduce your error, but only when I forgot to enable the collection of profiler data:
profiler: collect: false
Once this problem was resolved (the configuration that you provided to solve the problem for me), I managed to check the email in my Behat tests. Two solutions for this:
Solution # 1: intercept redirection worldwide
If this does not break all your other tests, you can do this by setting up your web profiler as follows:
web_profiler: intercept_redirects: true
Decision No. 2: Preventing Temporary Client Access to Redirects
For its part, intercepting redirects around the world in the configuration violated most of my other functional tests. Therefore, I use this method.
As the prevention of redirection allows you to mainly check data in data collectors, I decided to use the @collect tag for each script that requires redirecting interception. Then I used @BeforeScenario and @AfterScenario to enable this behavior only for these scenarios:
public function followRedirect() { $this->getDriver()->getClient()->followRedirect(); } public static function disableFollowRedirects(BeforeScenarioScope $scope) { $context = $scope->getEnvironment()->getContext(get_class()); $context->getDriver()->getClient()->followRedirects(false); } public static function restoreFollowRedirects(AfterScenarioScope $scope) { $context = $scope->getEnvironment()->getContext(get_class()); $context->getDriver()->getClient()->followRedirects(true); }
source share