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'); }
/** * 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; }