/**
  * @test
  */
 public function testBadLetterProposed()
 {
     $gameId = $this->getMiniGameId(666);
     $playerId = $this->getPlayerId(42);
     $letter = 'A';
     $playedLetters = array('A');
     $livesLost = 1;
     $remainingLives = 5;
     $wordSoFar = 'A _ _';
     $event = new HangmanBadLetterProposedEvent($gameId, $playerId, $letter, $playedLetters, $livesLost, $remainingLives, $wordSoFar);
     $this->assertEquals($gameId, $event->getGameId());
     $this->assertEquals($playerId, $event->getPlayerId());
     $this->assertEquals($letter, $event->getLetter());
     $this->assertEquals($playedLetters, $event->getPlayedLetters());
     $this->assertEquals($livesLost, $event->getLivesLost());
     $this->assertEquals($remainingLives, $event->getRemainingLives());
     $this->assertEquals($wordSoFar, $event->getWordSoFar());
     $this->assertEquals($wordSoFar, $event->getFeedback());
 }
Ejemplo n.º 2
0
 /**
  * Apply the bad letter played event
  *
  * @param  HangmanBadLetterProposedEvent $event
  * @return void
  */
 protected function applyHangmanBadLetterProposedEvent(HangmanBadLetterProposedEvent $event)
 {
     if ((string) $event->getPlayerId() === (string) $this->getId()) {
         $this->loseLife($event->getLivesLost());
         $this->playLetter($event->getLetter());
     }
 }