I have this Behat setting:
default: extensions: Behat\Symfony2Extension: ~ Behat\MinkExtension: sessions: default: symfony2: ~
And this scenario:
Scenario: Event list for authenticated user Given I am authenticated Then I should see pagination control And I should be able to change list page
I check to see if the user has been authenticated, and if so, show him Twig page control:
{% if is_granted('IS_AUTHENTICATED_FULLY') %} ...
Related Behat Context:
public function iAmAuthenticated() { $user = new User('test', null, ['ROLE_USER']); $token = new UsernamePasswordToken($user, null, 'test', $user->getRoles()); $this->getTokenStorage()->setToken($token); } public function iShouldSeePaginationControl() { $this->assertSession()->elementExists('css', 'ul.pagination'); }
I get true for
$this->kernel ->geContainer() ->get('security.authorization_checker') ->isGranted('IS_AUTHENTICATED_FULLY')
in my iShouldSeePaginationControl() , but it is false in the rendered content.
What am I missing?
source share