Defined stricter model to represent one geo location

This commit is contained in:
Alejandro Celaya
2019-02-17 12:59:55 +01:00
parent 5c5dde48de
commit e2abe23895
19 changed files with 204 additions and 198 deletions

View File

@@ -11,6 +11,7 @@ use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Common\Exception\WrongIpException;
use Shlinkio\Shlink\Common\IpGeolocation\GeoLite2LocationResolver;
use Shlinkio\Shlink\Common\IpGeolocation\Model\Location;
class GeoLite2LocationResolverTest extends TestCase
{
@@ -51,10 +52,8 @@ class GeoLite2LocationResolverTest extends TestCase
];
}
/**
* @test
*/
public function resolvedCityIsProperlyMapped()
/** @test */
public function resolvedCityIsProperlyMapped(): void
{
$ipAddress = '1.2.3.4';
$city = new City([]);
@@ -63,15 +62,7 @@ class GeoLite2LocationResolverTest extends TestCase
$result = $this->resolver->resolveIpLocation($ipAddress);
$this->assertEquals([
'country_code' => '',
'country_name' => '',
'region_name' => '',
'city' => '',
'latitude' => '',
'longitude' => '',
'time_zone' => '',
], $result);
$this->assertEquals(Location::emptyInstance(), $result);
$cityMethod->shouldHaveBeenCalledOnce();
}
}