Skip to content

Commit 3c072ed

Browse files
authored
Enable PHP 8.0 support (#1102)
* Enable PHP 8.0 support * Add GitHub Actions * Upgrade php-http/curl-client + php-http/httplug * Upgrade PHPUnit * Drop PHP 7.2 support * Update GitHub Actions Remove PHP 7.2 * Update Travis CI Remove PHP 7.2 * Drop PHP 7.2 support
1 parent e6743de commit 3c072ed

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

Tests/MapboxTest.php

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,37 @@ public function testGetName()
3838
$this->assertEquals('mapbox', $provider->getName());
3939
}
4040

41-
/**
42-
* @expectedException \Geocoder\Exception\UnsupportedOperation
43-
*/
4441
public function testGeocodeWithLocalhostIPv4()
4542
{
43+
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
44+
$this->expectExceptionMessage('The Mapbox provider does not support IP addresses, only street addresses.');
45+
4646
$provider = new Mapbox($this->getMockedHttpClient(), 'access_token');
4747
$provider->geocodeQuery(GeocodeQuery::create('127.0.0.1'));
4848
}
4949

50-
/**
51-
* @expectedException \Geocoder\Exception\UnsupportedOperation
52-
* @expectedExceptionMessage The Mapbox provider does not support IP addresses, only street addresses.
53-
*/
5450
public function testGeocodeWithLocalhostIPv6()
5551
{
52+
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
53+
$this->expectExceptionMessage('The Mapbox provider does not support IP addresses, only street addresses.');
54+
5655
$provider = new Mapbox($this->getMockedHttpClient(), 'access_token');
5756
$provider->geocodeQuery(GeocodeQuery::create('::1'));
5857
}
5958

60-
/**
61-
* @expectedException \Geocoder\Exception\UnsupportedOperation
62-
* @expectedExceptionMessage The Mapbox provider does not support IP addresses, only street addresses.
63-
*/
6459
public function testGeocodeWithRealIp()
6560
{
61+
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
62+
$this->expectExceptionMessage('The Mapbox provider does not support IP addresses, only street addresses.');
63+
6664
$provider = new Mapbox($this->getHttpClient(), 'access_token');
6765
$provider->geocodeQuery(GeocodeQuery::create('74.200.247.59'));
6866
}
6967

70-
/**
71-
* @expectedException \Geocoder\Exception\QuotaExceeded
72-
*/
7368
public function testGeocodeWithQuotaExceeded()
7469
{
70+
$this->expectException(\Geocoder\Exception\QuotaExceeded::class);
71+
7572
$provider = new Mapbox($this->getMockedHttpClient('', 429), 'access_token');
7673
$provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France'));
7774
}
@@ -152,11 +149,10 @@ public function testGeocodeWithRealAddress()
152149
$this->assertNull($result->getTimezone());
153150
}
154151

155-
/**
156-
* @expectedException \Geocoder\Exception\InvalidServerResponse
157-
*/
158152
public function testReverse()
159153
{
154+
$this->expectException(\Geocoder\Exception\InvalidServerResponse::class);
155+
160156
$provider = new Mapbox($this->getMockedHttpClient(), 'access_token');
161157
$provider->reverseQuery(ReverseQuery::fromCoordinates(1, 2));
162158
}
@@ -187,11 +183,10 @@ public function testReverseWithRealCoordinates()
187183
$this->assertEquals('address.1085979616', $result->getId());
188184
}
189185

190-
/**
191-
* @expectedException \Geocoder\Exception\InvalidCredentials
192-
*/
193186
public function testGeocodeWithInvalidApiKey()
194187
{
188+
$this->expectException(\Geocoder\Exception\InvalidCredentials::class);
189+
195190
$provider = new Mapbox($this->getMockedHttpClient('', 403), 'api_key');
196191
$provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France'));
197192
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^7.2",
15+
"php": "^7.3 || ^8.0",
1616
"geocoder-php/common-http": "^4.0",
1717
"willdurand/geocoder": "^4.0"
1818
},

0 commit comments

Comments
 (0)