public function testAuthenticateNoTokenFound()
{
$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(__METHOD__));
$request = new Request();
$request->attributes->set('username', $username);
$request->attributes->set('password', $password);
$usernamePasswordToken = new UsernamePasswordToken($username, $password, self::PROVIDER_KEY);
$this->authenticationManager->expects($this->once())->method('authenticate')->with($this->equalTo($usernamePasswordToken))->will($this->returnValue(null));
$this->logger->expects($this->once())->method('error');
$this->authenticator->authenticate($request);
}