/** @test */ public function finishAllPlayers() { $this->positions->finishPlayer(Player::$GREEN); $this->positions->finishPlayer(Player::$RED); $this->positions->finishPlayer(Player::$BLUE); $this->positions->finishPlayer(Player::$YELLOW); $this->assertTrue($this->positions->allPlayersFinished()); }
/** * @param Dice $dice * @param TokenNumber $tokenToMove * * @throws DomainException If the game has finished */ public function playTurn(Dice $dice, TokenNumber $tokenToMove) { if ($this->playersInGame->allPlayersFinished()) { throw new DomainException('All players finished, the game has ended.'); } $this->currentTurn++; $player = $this->currentPlayer(); $this->board->moveToken($player, $tokenToMove, $dice); if ($this->board->hasFinished($player)) { $this->playersInGame->finishPlayer($player); } if (!$dice->equals(6)) { $this->passTurn(); } }