Skip to content

Commit 7c39a96

Browse files
jbelienNyholm
authored andcommitted
Fix tests IpInfo (#899)
* Update src/Provider/IpInfo/Tests/IpInfoTest.php * Add cached responses
1 parent 991f68f commit 7c39a96

5 files changed

+37
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
s:170:"{
2+
"ip": "74.125.45.100",
3+
"city": "Tulsa",
4+
"region": "Oklahoma",
5+
"country": "US",
6+
"loc": "36.1540,-95.9928",
7+
"postal": "74102",
8+
"org": "AS15169 Google LLC"
9+
}";
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
s:230:"{
2+
"ip": "83.227.123.8",
3+
"hostname": "ua-83-227-123-8.bbcust.telenor.se",
4+
"city": "Karlskrona",
5+
"region": "Blekinge",
6+
"country": "SE",
7+
"loc": "56.1616,15.5866",
8+
"postal": "371 40",
9+
"org": "AS2119 Telenor Norge AS"
10+
}";
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
s:241:"{
2+
"ip": "2601:9:7680:363:75df:f491:6f85:352f",
3+
"city": "Mount Laurel",
4+
"region": "New Jersey",
5+
"country": "US",
6+
"loc": "39.9340,-74.8910",
7+
"postal": "08054",
8+
"phone": "856",
9+
"org": "AS7922 Comcast Cable Communications, LLC"
10+
}";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
s:70:"{
2+
"ip": "2001:0db8:0000:0042:0000:8a2e:0370:7334",
3+
"bogon": true
4+
}";

Tests/IpInfoTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ public function testGeocodeWithRealIPv6()
121121
/** @var Location $result */
122122
$result = $results->first();
123123
$this->assertInstanceOf('\Geocoder\Model\Address', $result);
124-
$this->assertEquals(37.751, $result->getCoordinates()->getLatitude(), '', 0.001);
125-
$this->assertEquals(-97.822, $result->getCoordinates()->getLongitude(), '', 0.001);
126-
$this->assertNull($result->getPostalCode());
127-
$this->assertEmpty($result->getLocality());
124+
$this->assertEquals(39.934, $result->getCoordinates()->getLatitude(), '', 0.001);
125+
$this->assertEquals(-74.891, $result->getCoordinates()->getLongitude(), '', 0.001);
126+
$this->assertEquals('08054', $result->getPostalCode());
127+
$this->assertEquals('Mount Laurel', $result->getLocality());
128128
$this->assertNull($result->getCountry()->getName());
129129
$this->assertEquals('US', $result->getCountry()->getCode());
130130
$this->assertNull($result->getTimezone());

0 commit comments

Comments
 (0)