protected function loadUserByIdentity($identity) { $user = parent::loadUserByIdentity($identity); if ($user->getCanOpenId() === false) { throw new InsufficientAuthenticationException('Cet utilisateur ne supporte pas cette méthode de login'); } return $user; }
/** * @test * * @expectedException Symfony\Component\Security\Core\Exception\AuthenticationServiceException * @expectedExceptionMessage The manager does not implement createUserFromIdentity method. Please extend manager and overwrite the method with your logic. */ public function throwAlwaysWhenCreateUserFromIdentityMethodCalled() { $manager = new UserManager($this->createIdentityManagerMock()); $manager->createUserFromIdentity('an_identity'); }