Skip to content

Commit

Permalink
[IP2LocationBinary] Upgrade tests (PHPUnit 9.5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelien committed Dec 21, 2020
1 parent 39a52c1 commit 2a9555e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions Tests/IP2LocationBinaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ public static function provideIps()
];
}

/**
* @expectedException \Geocoder\Exception\InvalidArgument
* @expectedExceptionMessage Given IP2Location BIN file "NOT_EXIST.BIN" does not exist.
*/
public function testThrowIfNotExistBinaryFileGiven()
{
$this->expectException(\Geocoder\Exception\InvalidArgument::class);
$this->expectExceptionMessage('Given IP2Location BIN file "NOT_EXIST.BIN" does not exist.');

new IP2LocationBinary('NOT_EXIST.BIN');
}

Expand Down Expand Up @@ -166,23 +165,21 @@ public function testGetName()
$this->assertEquals('ip2location_binary', $provider->getName());
}

/**
* @expectedException \Geocoder\Exception\UnsupportedOperation
* @expectedExceptionMessage The IP2LocationBinary provider does not support street addresses.
*/
public function testThrowIfInvalidIpAddressGiven()
{
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
$this->expectExceptionMessage('The IP2LocationBinary provider does not support street addresses.');

$provider = new IP2LocationBinary($this->binaryFile);

$provider->geocodeQuery(GeocodeQuery::create('invalidIp'));
}

/**
* @expectedException \Geocoder\Exception\UnsupportedOperation
* @expectedExceptionMessage The IP2LocationBinary is not able to do reverse geocoding.
*/
public function testThrowOnReverseMethodUsage()
{
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
$this->expectExceptionMessage('The IP2LocationBinary is not able to do reverse geocoding.');

$provider = new IP2LocationBinary($this->binaryFile);

$provider->reverseQuery(ReverseQuery::fromCoordinates(0, 0));
Expand Down

0 comments on commit 2a9555e

Please sign in to comment.