Example #1
0
 public function testCheckSuitIsCorrect()
 {
     foreach (SuitInterface::SUITS as $suit) {
         Card::checkSuitIsCorrect($suit);
         $this->addToAssertionCount(1);
     }
     $expectedException = CardException::incorrectSuit('notExistedSuit');
     $this->expectException(get_class($expectedException));
     $this->expectExceptionMessage($expectedException->getMessage());
     Card::checkSuitIsCorrect('notExistedSuit');
 }
Example #2
0
 /**
  * Is card with $suit in collection
  *
  * @param string $suit
  * @return bool
  */
 public function hasCardWithSuit(string $suit) : bool
 {
     Card::checkSuitIsCorrect($suit);
     foreach ($this->cards as $card) {
         if ($card->getSuit() === $suit) {
             return true;
         }
     }
     return false;
 }