Beispiel #1
0
 /**
  * @param string $email
  * @param string $remoteIp
  * @return User
  * @throws UserLoginException
  */
 private function getUserOrAssertAndRecordLoginFailure($email, $remoteIp)
 {
     try {
         $user = $this->userRepository->findOneByEmail($email);
     } catch (EntityNotFoundException $e) {
         $this->recordLogin($email, $remoteIp, UserLoginResultType::fail());
         throw UserLoginException::userNotFound();
     }
     if (!$user->getStatus()->isActive()) {
         $this->recordLogin($email, $remoteIp, UserLoginResultType::fail());
         throw UserLoginException::userNotActive();
     }
     return $user;
 }
 public function testFindOneByEmailThrowsException()
 {
     $this->setExpectedException(EntityNotFoundException::class, 'User not found');
     $this->userRepository->findOneByEmail('*****@*****.**');
 }