/** * @expectedException \Geocoder\Exception\NoResultException */ public function testGetGeocodedDataWithRealIPv4NoResults() { if (!isset($_SERVER['GEOIPS_API_KEY'])) { $this->markTestSkipped('You need to configure the GEOIPS_API_KEY value in phpunit.xml'); } $provider = new GeoIPsProvider($this->getAdapter(), $_SERVER['GEOIPS_API_KEY']); $result = $provider->getGeocodedData('255.255.150.96'); }
public function testGetGeocodedDataWithRealIPv4() { if (!isset($_SERVER['GEOIPS_API_KEY'])) { $this->markTestSkipped('You need to configure the GEOIPS_API_KEY value in phpunit.xml'); } $provider = new GeoIPsProvider(new \Geocoder\HttpAdapter\CurlHttpAdapter(), $_SERVER['GEOIPS_API_KEY']); $result = $provider->getGeocodedData('66.147.244.214'); $this->assertEquals('UNITED STATES', $result['country']); $this->assertEquals('US', $result['countryCode']); $this->assertEquals('UTAH', $result['region']); $this->assertEquals('UT', $result['regionCode']); $this->assertEquals('UTAH', $result['county']); $this->assertEquals('PROVO', $result['city']); $this->assertEquals(75093, $result['zipcode']); $this->assertEquals(40.3402, $result['latitude'], '', 0.0001); $this->assertEquals(-111.6073, $result['longitude'], '', 0.0001); $this->assertEquals('MST', $result['timezone']); $this->assertNull($result['streetName']); }