Skip to content

Commit 981549e

Browse files
author
Thomas Moeskops
authored
CountryCode missing in IpInfoDb provider (#1052)
* Update IpInfoDb.php CountryCode is currently missing, while it is among the response data from this provider. * Update IpInfoDbTest.php Test updated * Update IpInfoDbTest.php Updated test
1 parent 383314c commit 981549e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Provider/IpInfoDb/IpInfoDb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private function executeQuery(string $url): AddressCollection
149149
'postalCode' => $data['zipCode'] ?? null,
150150
'adminLevels' => isset($data['regionName']) ? [['name' => $data['regionName'], 'level' => 1]] : [],
151151
'country' => $data['countryName'] ?? null,
152-
'countryCode' => $data['countryName'] ?? null,
152+
'countryCode' => $data['countryCode'] ?? null,
153153
'timezone' => $timezone,
154154
]),
155155
]);

src/Provider/IpInfoDb/Tests/IpInfoDbTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function testGeocodeWithRealIPv4()
131131
$this->assertCount(1, $result->getAdminLevels());
132132
$this->assertEquals('Oklahoma', $result->getAdminLevels()->get(1)->getName());
133133
$this->assertEquals('United States', $result->getCountry()->getName());
134-
$this->assertEquals('United States', $result->getCountry()->getCode());
134+
$this->assertEquals('US', $result->getCountry()->getCode());
135135
$this->assertEquals('America/New_York', $result->getTimezone());
136136
}
137137

@@ -173,7 +173,7 @@ public function testGetGeocodedDataWithCountryPrecision()
173173
$this->assertNull($result->getLocality());
174174
$this->assertEmpty($result->getAdminLevels());
175175
$this->assertEquals('United States', $result->getCountry()->getName());
176-
$this->assertEquals('United States', $result->getCountry()->getCode());
176+
$this->assertEquals('US', $result->getCountry()->getCode());
177177
$this->assertNull($result->getTimezone());
178178
}
179179

0 commit comments

Comments
 (0)