Ejemplo n.º 1
0
 /**
  * @test
  * @dataProvider games
  * @expectedException \DomainException
  *
  * @param Game $game
  */
 public function cannotPlayTurnIfAllPlayersFinish(Game $game)
 {
     $seatsOccupied = array_slice(Player::values(), 0, $game->playersInGame());
     foreach ($seatsOccupied as $seat) {
         $this->finishPlayer($game, $seat);
     }
     $game->playTurn(new CheaterDice(6, 1), new TokenNumber(1));
 }
Ejemplo n.º 2
0
 private function positionPlayers($positions)
 {
     $position = 0;
     $players = array_slice(Player::values(), 0, $positions);
     /** @var Player $player */
     foreach ($players as $player) {
         $this->players[$position++] = $player;
     }
 }
Ejemplo n.º 3
0
 /**
  * @test
  * @dataProvider playerAfterTurns
  *
  * @param int    $turns
  * @param Player $color
  */
 public function isPlayerGivenTurn($turns, Player $color)
 {
     $this->passTurns($turns);
     $this->assertEquals($color->toString(), $this->positions->currentPlayer());
 }
Ejemplo n.º 4
0
<?php

namespace jb\ludo;

use precore\lang\Enum;
final class Player extends Enum
{
    public static $GREEN;
    public static $RED;
    public static $BLUE;
    public static $YELLOW;
}
Player::init();
// @codeCoverageIgnore
Ejemplo n.º 5
0
 /**
  * @param Player $player
  *
  * @return Square
  */
 public function getStartingSquare(Player $player)
 {
     $start = $this->startingSquares[$player->name()];
     return $this->squares->get($start);
 }