コード例 #1
0
 /**
  * @test
  */
 public function testHangmanOptionsWithWord()
 {
     $options = HangmanPlayerOptions::create($this->getPlayerId(42), $this->getMiniGameId(666), 'toto', 6, 'ext');
     $this->assertEquals(6, $options->getLives());
     $this->assertEquals('ext', $options->getExternalReference());
 }
コード例 #2
0
ファイル: HangmanTest.php プロジェクト: remi-san/hangman
 /**
  * @test
  */
 public function testPlayerOneLoses()
 {
     $letter = 'Z';
     $playerOne = HangmanPlayerOptions::create($this->playerOneId, $this->hangmanId, self::P1_NAME, 1);
     $hangman = Hangman::createGame($this->hangmanId, self::WORD);
     $hangman->addPlayerToGame($playerOne);
     $hangman->addPlayerToGame($this->playerTwo);
     $hangman->startGame($this->playerOneId);
     /* @var $feedback \Hangman\Result\HangmanLost */
     $feedback = $hangman->play($this->playerOneId, $this->getProposition($letter));
     $this->assertInstanceOf('\\Hangman\\Result\\HangmanLost', $feedback);
     $this->assertEquals($this->playerOneId, $feedback->getPlayerId());
     $this->assertEquals(array('Z' => 'Z'), $feedback->getPlayedLetters());
     $this->assertEquals(0, $feedback->getRemainingLives());
     $this->assertEquals(self::WORD, $feedback->getSolution());
     $this->assertFalse($hangman->canPlayerPlay($this->playerOneId));
     $this->assertTrue($hangman->canPlayerPlay($this->playerTwoId));
 }