Beispiel #1
0
 public function testGetRemainingAttempts()
 {
     $game = new Game(new Word('filament'), 0, 5);
     $game->tryLetter('f');
     $this->assertEquals($game->getMaxAttempts(), $game->getRemainingAttempts());
     $game->tryLetter('o');
     $this->assertEquals($game->getMaxAttempts() - 1, $game->getRemainingAttempts());
     $game->tryWord('foo');
     $this->assertEquals(0, $game->getRemainingAttempts());
 }
Beispiel #2
0
 public function testGetRemainingAttempts()
 {
     $game = new Game(new Word('php'));
     $game->tryLetter('h');
     $this->assertEquals(Game::MAX_ATTEMPTS, $game->getRemainingAttempts());
     $game->tryLetter('o');
     $this->assertEquals(Game::MAX_ATTEMPTS - 1, $game->getRemainingAttempts());
     $game->tryWord('foo');
     $this->assertEquals(0, $game->getRemainingAttempts());
 }