Example #1
0
 /**
  * Build and shuffle deck
  *
  * @throws GameLogicException If card count isn't right
  */
 private function buildAndShuffleDeck()
 {
     $orderedDeck = [];
     foreach (CardSuit::getAll() as $suit) {
         foreach (CardNumber::getAll() as $number) {
             $orderedDeck[] = new Card($number, $suit);
         }
     }
     // heh. name's appropriate.
     // Who knows how "random" this really is but it works to illustrate the point here.
     shuffle($orderedDeck);
     foreach ($orderedDeck as $card) {
         $this->deck->addCard($card);
     }
     $this->assertDeckCount(52);
 }