예제 #1
0
 /** @test */
 public function should_create_new_group()
 {
     $user = m::mock('Cribbb\\Domain\\Model\\Identity\\User');
     $this->users->shouldReceive('userById')->once()->andReturn($user);
     $this->groups->shouldReceive('groupOfName')->once()->andReturn(null);
     $this->groups->shouldReceive('add')->once();
     $group = $this->service->create('7c5e8127-3f77-496c-9bb4-5cb092969d89', 'Cribbb');
     $this->assertInstanceOf('Cribbb\\Domain\\Model\\Groups\\Group', $group);
 }
예제 #2
0
 /** @test */
 public function should_follow_other_user()
 {
     $user = m::mock('Cribbb\\Domain\\Model\\Identity\\User');
     $user->shouldReceive('follow')->once();
     $friend = m::mock('Cribbb\\Domain\\Model\\Identity\\User');
     $this->users->shouldReceive('userById')->times(2)->andReturn($user, $friend);
     $user = $this->service->follow('7c5e8127-3f77-496c-9bb4-5cb092969d89', 'a3d9e532-0ea8-4572-8e83-119fc49e4c6f');
     $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user);
 }
예제 #3
0
 /** @test */
 public function should_return_false_when_not_unique()
 {
     $this->repository->shouldReceive('userOfEmail')->andReturn(['id' => 1]);
     $this->assertFalse($this->spec->isSatisfiedBy(new Email('*****@*****.**')));
 }
예제 #4
0
 /** @test */
 public function should_return_false_when_not_unique()
 {
     $this->repository->shouldReceive('userOfUsername')->andReturn(['id' => 1]);
     $this->assertFalse($this->spec->isSatisfiedBy(new Username('philipbrown')));
 }