예제 #1
0
 /** @test */
 public function should_register_new_user()
 {
     $this->repository->shouldReceive('userOfEmail')->andReturn(null);
     $this->repository->shouldReceive('userOfUsername')->andReturn(null);
     $this->repository->shouldReceive('nextIdentity')->andReturn(UserId::generate());
     $this->hashing->shouldReceive('hash')->andReturn(new HashedPassword('password'));
     $this->repository->shouldReceive('add');
     $user = $this->registrar->register('*****@*****.**', 'First', 'Last', 'username', 'password');
     $this->assertInstanceOf(User::class, $user);
 }
예제 #2
0
 /**
  * register
  * @param $formUser
  * @return User
  */
 public function register($formUser)
 {
     //try catch block?
     $this->validateFormUser($formUser);
     return $this->registrar->register($formUser['email'], $formUser['firstName'], $formUser['lastName'], $formUser['password']);
 }