Exemple #1
0
 /**
  * @test
  */
 public function testPlayingTheGame()
 {
     $this->roundMock->expects($this->exactly(static::NB_ROUNDS))->method('play')->with($this->rulesSet)->will($this->returnValue($this->roundResultCollection));
     $gameResult = $this->sut->play($this->roundMockCollection);
     $this->assertInstanceOf('\\GameDomain\\Round\\RoundResultCollection', $gameResult);
     $this->assertCount(static::NB_ROUNDS, $gameResult);
 }
Exemple #2
0
 /**
  * @test
  */
 public function testPlayingTheGame()
 {
     $game = new Game(new StandardRulesSet());
     $gameResult = $game->play($this->getRounds());
     $expectedGameResult = $this->getExpectedGameResults();
     foreach ($gameResult->toArray() as $roundId => $roundResult) {
         foreach ($roundResult->toArray() as $stepId => $stepResult) {
             $expectedAnswer = $expectedGameResult[$roundId][$stepId];
             $this->assertTrue($stepResult->getPlayerAnswer()->isSameAs(new Answer($expectedAnswer)), 'Expected answer : ' . $expectedAnswer . '. Step result : ' . (string) $stepResult);
         }
     }
 }