# app/config/config_test.yml
framework:
profiler:
enabled: true
I tried leaving this set to false and enabling the the profiler for the next request with a step but it always said the profiler was diabled
# src/.../...Bundle/Features/Context/FeatureContext.php
/**
* @When /^(?:|I )enable the profiler$/
*/
public function iEnableProfiler()
{
$driver = $this->getSession()->getDriver();
$driver->getClient()->enableProfiler();
}
Also I needed to change the instance of checks from GoutteDriver and SymfonyDriver to KernelDriver. Also I did not need to tag the scenario @mink:symfony as the default session in behat.yml is set to symfony2. Below is what I ended up with. Hope this helps someone else.
# src/.../...Bundle/Features/Context/FeatureContext.php
public function getSymfonyProfile()
{
$driver = $this->getSession()->getDriver();
if (!$driver instanceof KernelDriver) {
throw new UnsupportedDriverActionException(
'You need to tag the scenario with '.
'"@mink:symfony". Using the profiler is not '.
'supported by %s', $driver
);
}
$profile = $driver->getClient()->getProfile();
if (false === $profile) {
throw new \RuntimeException(
'Emails cannot be tested as the profiler is '.
'disabled.'
);
}
return $profile;
}
public function canIntercept()
{
$driver = $this->getSession()->getDriver();
if (!$driver instanceof KernelDriver) {
throw new UnsupportedDriverActionException(
'You need to tag the scenario with '.
'"@mink:goutte" or "@mink:symfony". '.
'Intercepting the redirections is not '.
'supported by %s', $driver
);
}
}
# src/.../...Bundle/Features/....feature
Scenario: Send an email
Given I am on the homepage
When I fill in ...
And I press "Send message" without redirection
Then I should get an email to "..." with "..."
And I should be redirected