public function testAuthenticateAlreadyHaveSessionToken()
{
$username = 'foo_user';
$password = 'publish';
$existingToken = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
$this->tokenStorage->expects($this->once())->method('getToken')->will($this->returnValue($existingToken));
$existingToken->expects($this->once())->method('getUsername')->will($this->returnValue($username));
$existingToken->expects($this->once())->method('setAttribute')->with('isFromSession', true);
$request = new Request();
$request->attributes->set('username', $username);
$request->attributes->set('password', $password);
$this->assertSame($existingToken, $this->authenticator->authenticate($request));
}