public function testCheckPlayerHasCard() { $player = new Player('player name'); $card = TestDataProvider::getCard2(); $player->getCards()->append($card); $player->checkPlayerHasCard($card); $this->addToAssertionCount(1); $player->getCards()->clear(); $expectedException = PlayerException::playerDoesNotHaveCard($player, $card); $this->expectException(get_class($expectedException)); $this->expectExceptionMessage($expectedException->getMessage()); $player->checkPlayerHasCard($card); }
/** * When $winPlayer win round, it is collect all cards which are situated on GameTable * * @param Player $winPlayer */ protected function collectCardsByWinnerPlayer(Player $winPlayer) { $winCardsCollection = new CardCollection(); foreach ($this->getPlayers() as $player) { $winCardsCollection->appendMany($this->gameTable->getPlayerCards($player)->collectAll()); } $winCardsCollection->setAllVisible(false); $winCardsCollection->shuffle(); $winPlayer->getCards()->prependMany($winCardsCollection->collectAll()); }
/** * Add player to implemented game * * @param Player $player */ private function addPlayer(Player $player) { $this->players[] = $player; $player->setGame($this); $player->getCards()->clear(); }