/** @test */
 public function should_find_user_by_id()
 {
     $this->executor->execute($this->loader->getFixtures());
     $id = UserId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc');
     $user = $this->repository->userOfId($id);
     $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user);
     $this->assertEquals($id, $user->id());
 }
Beispiel #2
0
 /**
  * Find a User by their id
  *
  * @param string $id
  * @return User
  */
 private function findUserById($id)
 {
     $user = $this->users->userById(UserId::fromString($id));
     if ($user) {
         return $user;
     }
     throw new ValueNotFoundException("{$id} is not a valid user id");
 }
Beispiel #3
0
 /**
  * Load the User fixtures
  *
  * @param ObjectManager $manager
  * @return void
  */
 public function load(ObjectManager $manager)
 {
     $id = UserId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc');
     $email = new Email('*****@*****.**');
     $username = new Username('username');
     $password = new HashedPassword('qwerty');
     $user = User::register($id, $email, $username, $password);
     $manager->persist($user);
     $manager->flush();
 }
Beispiel #4
0
 /** @test */
 public function should_return_user_id_as_string()
 {
     $id = UserId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc');
     $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', $id->toString());
     $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', (string) $id);
 }
Beispiel #5
0
 /**
  * Get the User's id
  *
  * @return UserId;
  */
 public function id()
 {
     return UserId::fromString($this->id);
 }