public function test_it_returns_new_player_with_computer_strategy_for_nonhuman_player()
 {
     $computerStrategy = m::mock("TicTacToe\\Model\\PlayerStrategy\\ComputerStrategy");
     $this->strategyFactory->shouldReceive("createComputerStrategy")->andReturn($computerStrategy);
     $isHuman = false;
     $result = $this->playerFactory->create("name", $isHuman);
     $this->assertInstanceOf(Player::class, $result);
 }
Esempio n. 2
0
 /**
  * @return array (player1, player2)
  */
 private function createPlayers()
 {
     $players = [];
     foreach ([1, 2] as $number) {
         $msg = sprintf("Define the %d. player.", $number);
         $this->ioService->printMessageLine($msg);
         $isHumanPlayer = $this->definePlayerHumanity();
         $name = $this->definePlayerName();
         $players[] = $this->playerFactory->create($name, $isHumanPlayer);
     }
     return [$players[0], $players[1]];
 }