示例#1
0
 public function testHasCardWithSuit()
 {
     $cardCollection = new CardCollection();
     foreach (SuitInterface::SUITS as $suit) {
         $this->assertFalse($cardCollection->hasCardWithSuit($suit));
     }
     $addedCard = TestDataProvider::getCard2();
     $cardCollection->append($addedCard);
     foreach (SuitInterface::SUITS as $suit) {
         if ($addedCard->getSuit() === $suit) {
             $this->assertTrue($cardCollection->hasCardWithSuit($suit));
         } else {
             $this->assertFalse($cardCollection->hasCardWithSuit($suit));
         }
     }
     $expectedException = CardException::incorrectSuit('notExistedSuit');
     $this->expectException(get_class($expectedException));
     $this->expectExceptionMessage($expectedException->getMessage());
     $cardCollection->hasCardWithSuit('notExistedSuit');
 }