2020
2121class IP2LocationTest extends BaseTestCase
2222{
23- protected function getCacheDir ()
23+ protected function getCacheDir (): string
2424 {
2525 return __DIR__ .'/.cached_responses ' ;
2626 }
2727
28- public function testGetName ()
28+ public function testGetName (): void
2929 {
3030 $ provider = new IP2Location ($ this ->getMockedHttpClient (), 'api_key ' );
3131 $ this ->assertEquals ('ip2location ' , $ provider ->getName ());
3232 }
3333
34- public function testGeocodeWithRandomString ()
34+ public function testGeocodeWithRandomString (): void
3535 {
3636 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
3737 $ this ->expectExceptionMessage ('The IP2Location provider does not support street addresses, only IP addresses. ' );
@@ -40,7 +40,7 @@ public function testGeocodeWithRandomString()
4040 $ provider ->geocodeQuery (GeocodeQuery::create ('foobar ' ));
4141 }
4242
43- public function testGeocodeWithAddress ()
43+ public function testGeocodeWithAddress (): void
4444 {
4545 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
4646 $ this ->expectExceptionMessage ('The IP2Location provider does not support street addresses, only IP addresses. ' );
@@ -49,7 +49,7 @@ public function testGeocodeWithAddress()
4949 $ provider ->geocodeQuery (GeocodeQuery::create ('10 avenue Gambetta, Paris, France ' ));
5050 }
5151
52- public function testGeocodeWithInvalidKey ()
52+ public function testGeocodeWithInvalidKey (): void
5353 {
5454 $ this ->expectException (\Geocoder \Exception \InvalidCredentials::class);
5555 $ this ->expectExceptionMessage ('API Key provided is not valid. ' );
@@ -58,7 +58,7 @@ public function testGeocodeWithInvalidKey()
5858 $ results = $ provider ->geocodeQuery (GeocodeQuery::create ('74.125.45.100 ' ));
5959 }
6060
61- public function testGeocodeWithInvalidIPAddress ()
61+ public function testGeocodeWithInvalidIPAddress (): void
6262 {
6363 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
6464 $ this ->expectExceptionMessage ('The IP2Location provider does not support street addresses, only IP addresses. ' );
@@ -67,7 +67,7 @@ public function testGeocodeWithInvalidIPAddress()
6767 $ provider ->geocodeQuery (GeocodeQuery::create ('300.23.255.5 ' ));
6868 }
6969
70- public function testGeocodeWithRealIPv4 ()
70+ public function testGeocodeWithRealIPv4 (): void
7171 {
7272 if (!isset ($ _SERVER ['IP2LOCATION_API_KEY ' ])) {
7373 $ this ->markTestSkipped ('You need to configure the IP2LOCATION_API_KEY value in phpunit.xml ' );
@@ -92,7 +92,7 @@ public function testGeocodeWithRealIPv4()
9292 $ this ->assertEquals ('US ' , $ result ->getCountry ()->getCode ());
9393 }
9494
95- public function testGeocodeWithRealIPv6 ()
95+ public function testGeocodeWithRealIPv6 (): void
9696 {
9797 if (!isset ($ _SERVER ['IP2LOCATION_API_KEY ' ])) {
9898 $ this ->markTestSkipped ('You need to configure the IP2LOCATION_API_KEY value in phpunit.xml ' );
@@ -117,7 +117,7 @@ public function testGeocodeWithRealIPv6()
117117 $ this ->assertEquals ('US ' , $ result ->getCountry ()->getCode ());
118118 }
119119
120- public function testReverse ()
120+ public function testReverse (): void
121121 {
122122 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
123123 $ this ->expectExceptionMessage ('The IP2Location provider is not able to do reverse geocoding. ' );
0 commit comments