/** @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->registerUserService->register('*****@*****.**', 'username', 'password'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user); }
/** @test */ public function should_register_new_user() { $this->repository->shouldReceive('userOfEmail')->andReturn(null); $this->repository->shouldReceive('userOfUsername')->andReturn(null); $this->repository->shouldReceive('nextIdentity')->andReturn($this->uuid); $this->hashing->shouldReceive('hash')->andReturn($this->password); $this->repository->shouldReceive('add'); $this->dispatcher->shouldReceive('dispatch'); $user = $this->service->registerUser('*****@*****.**', 'username', 'password'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user); }