Skip to content

Commit d267b7c

Browse files
committed
Added seeRememberedAuthentication function
1 parent fbf5806 commit d267b7c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,27 @@ public function submitSymfonyForm(string $name, array $fields)
10011001
$this->submitForm($selector, $params, $button);
10021002
}
10031003

1004+
/**
1005+
* Checks that a user is authenticated with the 'remember me' option.
1006+
*
1007+
* ```php
1008+
* <?php
1009+
* $I->seeRememberedAuthentication();
1010+
* ```
1011+
*/
1012+
public function seeRememberedAuthentication()
1013+
{
1014+
$security = $this->grabService('security.helper');
1015+
1016+
$user = $security->getUser();
1017+
1018+
if (!$user) {
1019+
$this->fail('There is no user in session');
1020+
}
1021+
1022+
$this->assertTrue($security->isGranted('IS_AUTHENTICATED_REMEMBERED'), 'There is no authenticated user');
1023+
}
1024+
10041025
/**
10051026
* Check that the current user has a role
10061027
*

0 commit comments

Comments
 (0)