예제 #1
0
 /**
  * @test
  */
 public function passwordRetrievesProperHash()
 {
     $passwordString = 'ThisIsSomePasswordWord';
     $password = new Password($passwordString);
     $this->assertInstanceOf(PasswordHash::class, $password->toPasswordHash());
     $this->assertEquals($passwordString, $password->toString());
     $this->assertTrue(password_verify($passwordString, $password->toPasswordHash()->toString()));
 }
예제 #2
0
 /**
  * @param string $uuid
  * @param string $name
  * @param string $email
  * @param string $password
  * @param Role $role
  *
  * @return self
  */
 public static function create($uuid, $name, $email, $password, Role $role)
 {
     $userId = new UserUuid($uuid);
     $userName = new UserName($name);
     $userEmail = new UserEmail($email);
     $userPassword = new Password($password);
     $userActive = new UserActive(false);
     $user = new self($userId, $userName, $userEmail, $userPassword->toPasswordHash(), $userActive, $role);
     $createUserChange = new CreateUserChange($userId, $userName, $userEmail, $userPassword, $userActive, $role);
     $user->trackChange($createUserChange);
     return $user;
 }