Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 private function getUserByEmail(string $email) : User
 {
     try {
         $emailAddress = EmailAddress::get($email);
         return $this->userRepository->getByEmailAddress($emailAddress);
     } catch (NoUniqueResultException $exception) {
         throw LoginFailedException::invalidCredentials($exception);
     } catch (\InvalidArgumentException $exception) {
         throw LoginFailedException::invalidEmailAddress();
     }
 }
 public function it_errors_on_general_error()
 {
     $email = '*****@*****.**';
     $password = '******';
     $this->userRepository->getByEmailAddress(EmailAddress::get($email))->willThrow(new \RuntimeException());
     $this->shouldThrow(LoginFailedException::systemError())->duringLogin($email, $password);
 }
Ejemplo n.º 4
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $user = $this->userRepository->getByEmailAddress(EmailAddress::get($input->getArgument('email-address')));
     $this->userRepository->delete($user);
 }