예제 #1
0
 private function findUserByEmail(Email $email)
 {
     $user = $this->userRepository->userOfEmail($email);
     if (!$user) {
         throw new NotFoundException('user_email_not_found', $email);
     }
     return $user;
 }
예제 #2
0
 /** @test */
 public function should_add_new_user()
 {
     $userStub = UserStub::create();
     $user = $this->repository->add($userStub);
     $this->em->clear();
     $user = $this->repository->userOfEmail($userStub->email());
     $this->assertEquals($userStub->id(), $user->id());
     $this->assertEquals($userStub->email(), $user->email());
     $this->assertEquals($userStub->username(), $user->username());
     $this->assertEquals($userStub->firstName(), $user->firstName());
     $this->assertEquals($userStub->lastName(), $user->lastName());
 }
예제 #3
0
 /**
  * Attempt to find a user by their email address
  *
  * @param Email $email
  * @return User
  * @throws ValueNotFoundException
  */
 private function findUserByEmail(Email $email)
 {
     $user = $this->users->userOfEmail($email);
     if ($user) {
         return $user;
     }
     throw new ValueNotFoundException("{$email} is not a registered email address");
 }