public function it_can_be_executed(InputInterface $input, OutputInterface $output, User $user)
 {
     $email = '*****@*****.**';
     $input->getArgument('email-address')->willReturn($email);
     $this->userRepository->getByEmailAddress(EmailAddress::get($email))->willReturn($user);
     $this->userRepository->delete($user)->shouldBeCalled();
     $this->execute($input, $output);
 }
Exemple #2
0
 public function getUserForToken(UuidInterface $tokenUuid, string $passCode) : User
 {
     try {
         try {
             $token = $this->tokenService->getToken($tokenUuid, $passCode);
         } catch (NoUniqueResultException $exception) {
             throw LoginFailedException::invalidToken($exception);
         }
         return $this->userRepository->getByUuid($token->getUserUuid());
     } catch (\Throwable $exception) {
         if ($exception instanceof AuthException) {
             throw $exception;
         }
         $this->log(LogLevel::ERROR, $exception->getMessage());
         throw LoginFailedException::systemError($exception);
     }
 }
 public function it_can_get_a_user_by_token_and_pass_code(Token $token, User $user)
 {
     $tokenUuid = Uuid::uuid4();
     $passCode = bin2hex(random_bytes(20));
     $userUuid = Uuid::uuid4();
     $this->tokenService->getToken($tokenUuid, $passCode)->willReturn($token);
     $token->getUserUuid()->willReturn($userUuid);
     $this->userRepository->getByUuid($userUuid)->willReturn($user);
     $this->getUserForToken($tokenUuid, $passCode);
 }
Exemple #4
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $user = $this->userRepository->getByEmailAddress(EmailAddress::get($input->getArgument('email-address')));
     $this->userRepository->delete($user);
 }