Created
March 31, 2011 12:44
-
-
Save anonymous/896292 to your computer and use it in GitHub Desktop.
LoginListener.php snippet - the method to be tested
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function onSecurityInteractiveLogin(InteractiveLoginEvent $event) | |
{ | |
$session = $event->getRequest()->getSession(); | |
$username = $event->getAuthenticationToken()->getUser()->getUsername(); | |
$session->setFlash('notice', "Welcome {$username}, you have successfully logged in."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function testOnSecurityInteractiveLogin() | |
{ | |
$loginEvent = new LoginListener(); | |
// Get a mock $event of type InteractiveLoginEvent | |
$loginEvent->onSecurityInteractiveLogin($event); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment