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); }
protected function getBooleanAnswer($question) { $this->ioService->setLastGameServiceCall("getBooleanAnswer"); return parent::getBooleanAnswer($question); }
public function __construct(IOServiceInterface $ioService, BoardViewFactory $boardViewFactory) { parent::__construct($ioService); $this->boardViewFactory = $boardViewFactory; }