public function setUp() { parent::setUp(); $entityFactory = new \Dotapi2\Entity\EntityFactory(); $matchData = json_decode(file_get_contents('./tests/Responses/getMatchDetails.json'), true); $this->data = $matchData['result']; $this->entity = $entityFactory->create('DetailedMatch', $this->data); }
/** * Extracts entities from a propertySet. * * @param string $className * @param array $properties * @return array */ protected function extractEntities($className, array &$properties) { $entityIndex = $className::$entityIndex; $entityType = $className::$entityType; $entityFactory = new EntityFactory(); if (isset($properties[$entityIndex]) && is_array($properties[$entityIndex])) { $entities = array_map(function ($value) use($entityFactory, $entityType) { return $entityFactory->create($entityType, $value); }, $properties[$entityIndex]); unset($properties[$entityIndex]); return (array) $entities; } return []; }
/** * Get entity from response * * @param string $entityType * * @return Entity * @throws Exception */ public function getEntity($entityType) { $entityFactory = new EntityFactory(); return $entityFactory->create($entityType, $this->getResult()); }
public function testGetPicksBans() { $entityFactory = new EntityFactory(); $entity = $entityFactory->create('DetailedMatch', ['picks_bans' => []]); $this->assertInstanceOf('\\Dotapi2\\Collection\\PickBanSequence', $entity->getPicksBans()); }
public function setUp() { parent::setUp(); $factory = new EntityFactory(); $this->entity = $factory->create('TowerStatus', [1975]); }
public function setUp() { parent::setUp(); $factory = new EntityFactory(); $this->entity = $factory->create('BarracksStatus', [61]); }
public function testGetSlot() { $entityFactory = new EntityFactory(); $entity = $entityFactory->create('Slot', ['player_slot' => 4]); $this->assertEquals(4, $entity->getSlot()); }
public function testIsAnonymousAnonymous() { $entityFactory = new EntityFactory(); $entity = $entityFactory->create('Player', ['account_id' => 4294967295]); $this->assertEquals(true, $entity->isAnonymous()); }