How can I manualy make sure that user is not logged in my FeatureContext class in BDD Behat scenario? For example I have this scenario:
Scenario: passing wrong values will not get me in
Given I am on "/login"
And I am not logged in
When I fill in "login" with "KtokolwiekWidzialKtokolwiekWie"
When I fill in "password" with "root_as_allways"
When I press "Login"
Then I should be on "/"
And I should see "Wrong login or password"
And I've defined this context:
/**
* @Given /^I am not logged in$/
*/
public function iAmNotLoggedIn()
{
# logout currently login user, if any
$request = $this->kernel->getContainer()->get('request');
$request->getSession()->invalidate();
}
But this gives me an error when running this feature test.
You cannot create a service ("request") of an inactive scope ("request").
Note: I'm using Symfony 2.1 RC-1