コード例 #1
0
 /**
  * Tests if the service add Player calls
  * the players repo AddPlayer method.
  */
 public function testAddPlayerWithExpectedMethodFlow()
 {
     $userID = 1;
     $fakeUser = m::mock('App\\Models\\User');
     $fakePlayer = m::mock('App\\Models\\Player');
     $this->fakeUsersRepo->shouldReceive('getUser')->with($userID)->once()->andReturn($fakeUser);
     $this->fakePlayersRepo->shouldReceive('addPlayer')->withArgs(array(m::type('App\\Models\\User'), 'nickname'))->once()->andReturn($fakePlayer);
     $player = $this->service->addPlayer($userID, 'nickname');
     $this->assertEquals($player, $fakePlayer);
 }