public function testHandler() { $this->assertTrue($this->handler->verifyAccessToken() instanceof stdClass); $this->assertTrue($this->handler->tokenDecode() instanceof stdClass); $this->assertTrue(is_array($this->handler->getMarketTypes())); $this->assertTrue(is_array($this->handler->getMarketTypeHrefs())); $this->assertTrue(is_array($this->handler->getRegions())); $this->assertTrue($this->handler->getRegion(10000002) instanceof stdClass); $this->assertTrue(is_array($this->handler->getConstellationHrefs())); $this->assertTrue($this->handler->getConstellation(21000316) instanceof stdClass); $this->assertTrue(is_array($this->handler->getSolarSystemHrefs())); $this->assertTrue($this->handler->getSolarSystem(31000054) instanceof stdClass); $this->assertTrue($this->handler->getMarketOrders(34, 10000002) instanceof stdClass); $this->assertTrue(is_array($this->handler->getMarketHistory(34, 10000002))); $this->assertTrue(is_array($this->handler->getIndustrySystems())); $this->assertTrue(is_array($this->handler->getMarketPrices())); $this->assertTrue(is_array($this->handler->getIndustryFacilities())); $this->assertTrue(is_array($this->handler->getItemGroups())); $this->assertTrue($this->handler->getItemGroup(40) instanceof stdClass); $this->assertTrue(is_array($this->handler->getAlliances())); $this->assertTrue($this->handler->getAlliance(99000652) instanceof stdClass); $this->assertTrue(is_array($this->handler->getItemTypes())); $this->assertTrue($this->handler->getType(35) instanceof stdClass); $this->assertTrue(is_array($this->handler->getItemCategories())); $this->assertTrue($this->handler->getItemCategory(5) instanceof stdClass); $this->assertTrue(is_array($this->handler->getMarketGroups())); $this->assertTrue($this->handler->getMarketGroup(2) instanceof stdClass); $this->assertTrue(is_array($this->handler->getMarketGroupTypes(2))); $this->assertTrue(is_array($this->handler->getTournaments())); $this->assertTrue($this->handler->getWar(1) instanceof stdClass); $this->assertTrue($this->handler->getKillmail('http://public-crest.eveonline.com/killmails/30290604/787fb3714062f1700560d4a83ce32c67640b1797/') instanceof stdClass); }
/** * Fetches the typeIds of the items that need updating in a region * * @param int $regionId to be checked * @param int $cutoffTs the unix timestamp to be used to decide if data is too old * @param string $dateColumn the DB column to check the timestamp on, either 'lastHistUpdate' or 'lastPriceUpdate' * @param \iveeCrest\EndpointHandler $eph to be used * * @return array */ protected static function getTypeIdsToUpdate($regionId, $cutoffTs, $dateColumn, EndpointHandler $eph) { //get matket typeIds from CREST $marketTypeIds = array_keys($eph->getMarketTypeHrefs()); //get the subset Ids that need updating and are not Dust-only $res = static::$sde->query("SELECT typeID\n FROM invTypes\n WHERE typeID IN (" . implode(', ', $marketTypeIds) . ")\n AND typeID < 350000\n AND typeID NOT IN (\n SELECT typeID\n FROM " . Config::getIveeDbName() . ".trackedMarketData\n WHERE regionID = " . (int) $regionId . "\n AND " . $dateColumn . " > '" . date('Y-m-d H:i:s', $cutoffTs) . "'\n )\n ORDER BY typeID ASC;"); $ret = []; while ($tmp = $res->fetch_array(MYSQL_NUM)) { $ret[] = (int) $tmp[0]; } return $ret; }