/** * Set a global default database file for all future Ip2Location instances. * * @static * @param string $dbFile * @return void */ public static function setDefaultDbFile($dbFile) { self::$_defaultDbFile = $dbFile; }
/** * @return void */ public function testPartialLookup() { $ip2loc = new Rych_Ip2Location(LIBRARY_ROOT . '/tests/_files/Rych/Ip2Location/DB1-DEMO.bin'); // Fun fact: the IP belongs to ip2location.com :-) $record = $ip2loc->lookup('70.86.96.219'); $this->assertTrue($record instanceof Rych_Ip2Location_Record); $this->assertEquals('70.86.96.219', $record->ipAddress); $this->assertEquals(1180066011, $record->ipNumber); $this->assertEquals('US', $record->countryShort); $this->assertEquals('UNITED STATES', $record->countryLong); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->region); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->city); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->isp); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->latitude); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->longitude); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->domain); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->zipCode); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->timeZone); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->netSpeed); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->iddCode); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->areaCode); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->weatherCode); $this->assertEquals(Rych_Ip2Location::UNSUPPORTED, $record->weatherName); }