public function testCheckAuthenticationAlreadyLoggedIn()
{
$password = 'encoded_password';
$apiUser = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\User\\User')->setConstructorArgs(array(array('passwordHash' => $password)))->getMockForAbstractClass();
$tokenUser = new User($apiUser);
$token = new UsernamePasswordToken($tokenUser, 'foo', 'bar');
$user = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\Security\\User');
$user->expects($this->once())->method('getAPIUser')->will($this->returnValue($apiUser));
$this->repository->expects($this->once())->method('setCurrentUser')->with($apiUser);
$method = new \ReflectionMethod($this->authProvider, 'checkAuthentication');
$method->setAccessible(true);
$method->invoke($this->authProvider, $user, $token);
}