2020
2121class IpInfoDbTest extends BaseTestCase
2222{
23- protected function getCacheDir ()
23+ protected function getCacheDir (): string
2424 {
2525 return __DIR__ .'/.cached_responses ' ;
2626 }
2727
28- public function testConstructWithInvalidPrecision ()
28+ public function testConstructWithInvalidPrecision (): void
2929 {
3030 $ this ->expectException (\Geocoder \Exception \InvalidArgument::class);
3131 $ this ->expectExceptionMessage ('Invalid precision value "foo" (allowed values: "city", "country"). ' );
3232
3333 new IpInfoDb ($ this ->getMockedHttpClient (), 'api_key ' , 'foo ' );
3434 }
3535
36- public function testGetName ()
36+ public function testGetName (): void
3737 {
3838 $ provider = new IpInfoDb ($ this ->getMockedHttpClient (), 'api_key ' );
3939 $ this ->assertEquals ('ip_info_db ' , $ provider ->getName ());
4040 }
4141
42- public function testGeocodeWithRandomString ()
42+ public function testGeocodeWithRandomString (): void
4343 {
4444 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
4545 $ this ->expectExceptionMessage ('The IpInfoDb provider does not support street addresses, only IPv4 addresses. ' );
@@ -48,7 +48,7 @@ public function testGeocodeWithRandomString()
4848 $ provider ->geocodeQuery (GeocodeQuery::create ('foobar ' ));
4949 }
5050
51- public function testGeocodeWithAddress ()
51+ public function testGeocodeWithAddress (): void
5252 {
5353 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
5454 $ this ->expectExceptionMessage ('The IpInfoDb provider does not support street addresses, only IPv4 addresses. ' );
@@ -57,7 +57,7 @@ public function testGeocodeWithAddress()
5757 $ provider ->geocodeQuery (GeocodeQuery::create ('10 avenue Gambetta, Paris, France ' ));
5858 }
5959
60- public function testGeocodeWithLocalhostIPv4 ()
60+ public function testGeocodeWithLocalhostIPv4 (): void
6161 {
6262 $ provider = new IpInfoDb ($ this ->getMockedHttpClient (), 'api_key ' );
6363 $ results = $ provider ->geocodeQuery (GeocodeQuery::create ('127.0.0.1 ' ));
@@ -78,7 +78,7 @@ public function testGeocodeWithLocalhostIPv4()
7878 $ this ->assertEquals ('localhost ' , $ result ->getCountry ()->getName ());
7979 }
8080
81- public function testGeocodeWithLocalhostIPv6 ()
81+ public function testGeocodeWithLocalhostIPv6 (): void
8282 {
8383 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
8484 $ this ->expectExceptionMessage ('The IpInfoDb provider does not support IPv6 addresses, only IPv4 addresses. ' );
@@ -87,23 +87,23 @@ public function testGeocodeWithLocalhostIPv6()
8787 $ provider ->geocodeQuery (GeocodeQuery::create ('::1 ' ));
8888 }
8989
90- public function testGeocodeWithRealIPv4GetsNullContent ()
90+ public function testGeocodeWithRealIPv4GetsNullContent (): void
9191 {
9292 $ this ->expectException (\Geocoder \Exception \InvalidServerResponse::class);
9393
9494 $ provider = new IpInfoDb ($ this ->getMockedHttpClient (), 'api_key ' );
9595 $ provider ->geocodeQuery (GeocodeQuery::create ('74.125.45.100 ' ));
9696 }
9797
98- public function testGeocodeWithRealIPv4GetsEmptyContent ()
98+ public function testGeocodeWithRealIPv4GetsEmptyContent (): void
9999 {
100100 $ this ->expectException (\Geocoder \Exception \InvalidServerResponse::class);
101101
102102 $ provider = new IpInfoDb ($ this ->getMockedHttpClient (), 'api_key ' );
103103 $ provider ->geocodeQuery (GeocodeQuery::create ('74.125.45.100 ' ));
104104 }
105105
106- public function testGeocodeWithRealIPv4 ()
106+ public function testGeocodeWithRealIPv4 (): void
107107 {
108108 if (!isset ($ _SERVER ['IPINFODB_API_KEY ' ])) {
109109 $ this ->markTestSkipped ('You need to configure the IPINFODB_API_KEY value in phpunit.xml ' );
@@ -129,7 +129,7 @@ public function testGeocodeWithRealIPv4()
129129 $ this ->assertEquals ('America/New_York ' , $ result ->getTimezone ());
130130 }
131131
132- public function testGeocodeWithRealIPv6 ()
132+ public function testGeocodeWithRealIPv6 (): void
133133 {
134134 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
135135 $ this ->expectExceptionMessage ('The IpInfoDb provider does not support IPv6 addresses, only IPv4 addresses. ' );
@@ -145,7 +145,7 @@ public function testGeocodeWithRealIPv6()
145145 /**
146146 * @group temp
147147 */
148- public function testGetGeocodedDataWithCountryPrecision ()
148+ public function testGetGeocodedDataWithCountryPrecision (): void
149149 {
150150 if (!isset ($ _SERVER ['IPINFODB_API_KEY ' ])) {
151151 $ this ->markTestSkipped ('You need to configure the IPINFODB_API_KEY value in phpunit.xml ' );
@@ -170,7 +170,7 @@ public function testGetGeocodedDataWithCountryPrecision()
170170 $ this ->assertNull ($ result ->getTimezone ());
171171 }
172172
173- public function testReverse ()
173+ public function testReverse (): void
174174 {
175175 $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
176176 $ this ->expectExceptionMessage ('The IpInfoDb provider is not able to do reverse geocoding. ' );
0 commit comments