Beispiel #1
0
 public function testTryLetter()
 {
     $game = new Game(new Word('php'));
     $this->assertFalse($game->tryLetter('3'));
     $this->assertEquals(1, $game->getAttempts());
     $this->assertFalse($game->tryLetter('e'));
     $this->assertEquals(2, $game->getAttempts());
     $this->assertTrue($game->tryLetter('p'));
     $this->assertEquals(2, $game->getAttempts());
     $this->assertFalse($game->tryLetter('p'));
     $this->assertEquals(3, $game->getAttempts());
 }
Beispiel #2
0
 public function testTryWrongWord()
 {
     $game = new Game(new Word('filament'), 0, 5);
     $this->assertFalse($game->tryWord('magnificent'));
     $this->assertEquals($game->getMaxAttempts(), $game->getAttempts());
 }