Skip to content

Instantly share code, notes, and snippets.

Created March 31, 2011 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/896292 to your computer and use it in GitHub Desktop.
Save anonymous/896292 to your computer and use it in GitHub Desktop.
LoginListener.php snippet - the method to be tested
public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
{
$session = $event->getRequest()->getSession();
$username = $event->getAuthenticationToken()->getUser()->getUsername();
$session->setFlash('notice', "Welcome {$username}, you have successfully logged in.");
}
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