/** * Tests the basic methods of Entity class */ public function testPlayer() { $player = new Player(); $player->setId(1); $player->setName('Switchback'); $this->assertEquals($player->getId(), 1); $this->assertEquals($player->getName(), 'Switchback'); // TODO: test deck // TODO: test hero }
/** * Setup stuff */ protected function setUp() { // Seed random so we can predict the outcome of random events srand(self::RANDOM_SEED); // Create players $me = new Player(); $me->setId(1); $me->setName('Switchback'); $me->setHero(new GarroshHellscream()); // Warrior hero $opponent = new Player(); $opponent->setId(2); $opponent->setName('SMOrcThaBork'); $opponent->setHero(new GarroshHellscream()); // Warrior hero // Create board $this->board = new Board($me, $opponent); }
/** * Return battlefield for player * * @param \PHPHearthSim\Model\Player $player * @return array */ public function getBattlefieldForPlayer(Player $player) { // Create empty battlefield if it does not exist if (!isset($this->battlefield[$player->getId()])) { $this->battlefield[$player->getId()] = []; } return $this->battlefield[$player->getId()]; }