Esempio n. 1
0
 public function test_it_returns_move_fetched_from_player_strategy()
 {
     $strategyMove = ["strategy", "move"];
     $this->playerStrategy->shouldReceive("getMove")->andReturn($strategyMove);
     $game = m::mock("TicTacToe\\Model\\Game");
     $this->assertEquals($strategyMove, $this->player->getMove($game));
 }
Esempio n. 2
0
 /**
  * @param Player $startingPlayer
  * @param Player $opposingPlayer
  * @return Game
  */
 public function create(Player $startingPlayer, Player $opposingPlayer)
 {
     $startingPlayer->setGameMark(self::PLAYER_MARK_1);
     $opposingPlayer->setGameMark(self::PLAYER_MARK_2);
     return new Game($startingPlayer, $opposingPlayer);
 }
Esempio n. 3
0
 /**
  * @param Player|null $winner
  */
 private function showResult(Player $winner = null)
 {
     $result = null === $winner ? "it's a draw!\n" : sprintf("%s has won! Congrats.\n", $winner->getName());
     $this->ioService->printMessageLine("End of the game: " . $result);
 }