Beispiel #1
0
 public function testCheckIfAreDiffrentPlayers()
 {
     $player1 = new Player('player 1');
     $player2 = new Player('player 2');
     Player::checkIfAreDiffrentPlayers($player1, $player2);
     $this->addToAssertionCount(1);
     $expectedException = PlayerException::theseSamePlayers($player1);
     $this->expectException(get_class($expectedException));
     $this->expectExceptionMessage($expectedException->getMessage());
     Player::checkIfAreDiffrentPlayers($player1, $player1);
 }
Beispiel #2
0
 /**
  * Check if two players are diffrent
  *
  * @param Player $player1
  * @param Player $player2
  * @throws PlayerException
  */
 public static function checkIfAreDiffrentPlayers(Player $player1, Player $player2)
 {
     if ($player1 === $player2) {
         throw PlayerException::theseSamePlayers($player1);
     }
 }