Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Geocoder/Provider/MaxMind.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private function executeQuery($query)
}

return $this->returnResults([
array_merge($this->getDefaults(), $data)
$this->fixEncoding(array_merge($this->getDefaults(), $data))
]);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
s:187:"US,"United States",UT,Utah,Provo,40.2181,-111.6133,770,801,America/Denver,NA,84606,"Unified Layer","Unified Layer",bluehost.com,"AS46606 Unified Layer",Corporate,residential,999,83,5,5,5,";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
s:79:"US,UT,Provo,84606,40.218102,-111.613297,770,801,"Unified Layer","Unified Layer"";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
s:215:"BR,Brazil,26,"Santa Catarina",Florian�polis,-27.5833,-48.5667,,,America/Sao_Paulo,SA,,"Global Village Telecom","Global Village Telecom",gvt.net.br,"AS18881 Global Village Telecom",Cable/DSL,residential,18,99,52,92,,";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
s:96:"BR,26,Florian�polis,,-27.583300,-48.566700,0,0,"Global Village Telecom","Global Village Telecom"";
33 changes: 33 additions & 0 deletions tests/Geocoder/Tests/Provider/MaxMindTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,39 @@ public function testGeocodeOmniServiceWithRealIPv4()
$this->assertEquals('America/Chicago', $result->getTimezone());
}

public function testGeocodeOmniServiceWithRealIPv4WithSslAndEncoding()
{
if (!isset($_SERVER['MAXMIND_API_KEY'])) {
$this->markTestSkipped('You need to configure the MAXMIND_API_KEY value in phpunit.xml');
}

$provider = new MaxMind($this->getAdapter(), $_SERVER['MAXMIND_API_KEY'],
MaxMind::OMNI_SERVICE, true);
$results = $provider->geocode('189.26.128.80');

$this->assertInstanceOf('Geocoder\Model\AddressCollection', $results);
$this->assertCount(1, $results);

/** @var \Geocoder\Model\Address $result */
$result = $results->first();
$this->assertInstanceOf('\Geocoder\Model\Address', $result);
$this->assertEquals(-27.5833, $result->getLatitude(), '', 0.1);
$this->assertEquals(-48.5666, $result->getLongitude(), '', 0.1);
$this->assertFalse($result->getBounds()->isDefined());
$this->assertNull($result->getStreetNumber());
$this->assertNull($result->getStreetName());
$this->assertNull($result->getPostalCode());
$this->assertEquals('Florianópolis', $result->getLocality());
$this->assertNull($result->getSubLocality());
$this->assertNull($result->getCounty()->getName());
$this->assertNull($result->getCounty()->getCode());
$this->assertEquals('Santa Catarina', $result->getRegion()->getName());
$this->assertEquals('26', $result->getRegion()->getCode());
$this->assertEquals('Brazil', $result->getCountry()->getName());
$this->assertEquals('BR', $result->getCountry()->getCode());
$this->assertEquals('America/Sao_Paulo', $result->getTimezone());
}

public function testGeocodeWithRealIPv6()
{
if (!isset($_SERVER['MAXMIND_API_KEY'])) {
Expand Down