コード例 #1
0
 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);
 }
コード例 #2
0
 protected function getBooleanAnswer($question)
 {
     $this->ioService->setLastGameServiceCall("getBooleanAnswer");
     return parent::getBooleanAnswer($question);
 }
コード例 #3
0
 public function __construct(IOServiceInterface $ioService, BoardViewFactory $boardViewFactory)
 {
     parent::__construct($ioService);
     $this->boardViewFactory = $boardViewFactory;
 }