Esempio n. 1
0
 /**
  * @test
  */
 public function testHandleHangmanBadLetterProposedEventForPlayer()
 {
     $id = $this->getPlayerId(42);
     $name = 'Douglas';
     $lives = 5;
     $game = \Mockery::mock('\\Hangman\\Entity\\Hangman');
     $player = new HangmanPlayer($id, $name, $lives, $game);
     $player->handleRecursively(new HangmanBadLetterProposedEvent($this->getMiniGameId(33), $id, 'A', array(), 1, $lives - 1, ''));
     $this->assertEquals($lives - 1, $player->getRemainingLives());
 }
Esempio n. 2
0
 /**
  * Apply the player created event
  *
  * @param  HangmanPlayerCreatedEvent $event
  * @return void
  */
 protected function applyHangmanPlayerCreatedEvent(HangmanPlayerCreatedEvent $event)
 {
     $player = new HangmanPlayer($event->getPlayerId(), $event->getPlayerName(), $event->getLives(), $this, $event->getExternalReference());
     $this->gameOrder[] = (string) $player->getId();
     $this->players[(string) $player->getId()] = $player;
 }