コード例 #1
0
 public function testPlayerShipsAndOtherShips()
 {
     $user1 = $this->prophesize('AppBundle\\Entity\\User');
     $user2 = $this->prophesize('AppBundle\\Entity\\User');
     $user1Ships = ['A1'];
     $user2Ships = ['B2'];
     $user1->getId()->willReturn(1);
     $user2->getId()->willReturn(2);
     $this->game->setUser1Ships($user1Ships);
     $this->game->setUser2Ships($user2Ships);
     $this->game->setUser1($user1->reveal());
     $this->game->setUser2($user2->reveal());
     $this->game->setLoggedUser($user1->reveal());
     $this->assertEquals($user1Ships, $this->game->getPlayerShips());
     $this->assertEquals($user2Ships, $this->game->getOtherShips());
     $this->game->setLoggedUser($user2->reveal());
     $this->assertEquals($user2Ships, $this->game->getPlayerShips());
     $this->assertEquals($user1Ships, $this->game->getOtherShips());
 }