Exemplo n.º 1
0
 protected function getCurrentGamePlayerNames()
 {
     $players = $this->current_game->getPlayers();
     $names = array_map(function ($player) {
         return $player->getName();
     }, $players);
     return $names;
 }
Exemplo n.º 2
0
 public function testSetCurrentPlayerToNextPlayer()
 {
     $game = new Game('creating_player_name');
     $game->addPlayer('new_player_one');
     $game->addPlayer('new_player_two');
     $game->start();
     $game->setCurrentPlayerToNextPlayer();
     $game->setCurrentPlayerToNextPlayer();
     $players = $game->getPlayers();
     $last_player = array_pop($players);
     // Because start() randomizes the players, this is the only way to know what the last player is
     $current_player = $game->getCurrentPlayer();
     $this->assertSame($last_player->getName(), $current_player->getName());
 }