/** * @expectedException \TicTacToe\Exception\GameServiceException */ public function test_it_throws_GameServiceException_if_opposing_player_has_no_game_mark_when_running_game() { $this->game->shouldReceive("isStarted")->andReturn(false); $this->game->shouldReceive("getCurrentPlayerMark")->andReturn('X'); $this->game->shouldReceive("getOtherPlayerMark")->andReturnNull(); $this->gameService->run($this->game); }
public function test_player_with_computer_strategy_never_loses_if_other_strategy_player_starts_game() { $computerStrategy = new ComputerStrategy($this->ioService); $otherStrategy = new RandomStrategy(); $player1 = new Player("Alice", $computerStrategy); $player2 = new Player("Bob", $otherStrategy); $game = $this->gameFactory->create($player2, $player1); $winningPlayer = $this->gameService->run($game); $this->assertTrue(null === $winningPlayer || $player1 == $winningPlayer); }