@@ -31,42 +31,38 @@ public function testGetName()
3131 $ this ->assertEquals ('ip2location ' , $ provider ->getName ());
3232 }
3333
34- /**
35- * @expectedException \Geocoder\Exception\UnsupportedOperation
36- * @expectedExceptionMessage The IP2Location provider does not support street addresses, only IP addresses.
37- */
3834 public function testGeocodeWithRandomString ()
3935 {
36+ $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
37+ $ this ->expectExceptionMessage ('The IP2Location provider does not support street addresses, only IP addresses. ' );
38+
4039 $ provider = new IP2Location ($ this ->getMockedHttpClient (), 'api_key ' );
4140 $ provider ->geocodeQuery (GeocodeQuery::create ('foobar ' ));
4241 }
4342
44- /**
45- * @expectedException \Geocoder\Exception\UnsupportedOperation
46- * @expectedExceptionMessage The IP2Location provider does not support street addresses, only IP addresses.
47- */
4843 public function testGeocodeWithAddress ()
4944 {
45+ $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
46+ $ this ->expectExceptionMessage ('The IP2Location provider does not support street addresses, only IP addresses. ' );
47+
5048 $ provider = new IP2Location ($ this ->getMockedHttpClient (), 'api_key ' );
5149 $ provider ->geocodeQuery (GeocodeQuery::create ('10 avenue Gambetta, Paris, France ' ));
5250 }
5351
54- /**
55- * @expectedException \Geocoder\Exception\InvalidCredentials
56- * @expectedExceptionMessage API Key provided is not valid.
57- */
5852 public function testGeocodeWithInvalidKey ()
5953 {
54+ $ this ->expectException (\Geocoder \Exception \InvalidCredentials::class);
55+ $ this ->expectExceptionMessage ('API Key provided is not valid. ' );
56+
6057 $ provider = new IP2Location ($ this ->getHttpClient ('invalid_key ' ), 'api_key ' );
6158 $ results = $ provider ->geocodeQuery (GeocodeQuery::create ('74.125.45.100 ' ));
6259 }
6360
64- /**
65- * @expectedException \Geocoder\Exception\UnsupportedOperation
66- * @expectedExceptionMessage The IP2Location provider does not support street addresses, only IP addresses.
67- */
6861 public function testGeocodeWithInvalidIPAddress ()
6962 {
63+ $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
64+ $ this ->expectExceptionMessage ('The IP2Location provider does not support street addresses, only IP addresses. ' );
65+
7066 $ provider = new IP2Location ($ this ->getMockedHttpClient (), 'api_key ' );
7167 $ provider ->geocodeQuery (GeocodeQuery::create ('300.23.255.5 ' ));
7268 }
@@ -86,8 +82,8 @@ public function testGeocodeWithRealIPv4()
8682 /** @var Location $result */
8783 $ result = $ results ->first ();
8884 $ this ->assertInstanceOf ('\Geocoder\Model\Address ' , $ result );
89- $ this ->assertEquals (36.154 , $ result ->getCoordinates ()->getLatitude (), '' , 0.001 );
90- $ this ->assertEquals (-95.9928 , $ result ->getCoordinates ()->getLongitude (), '' , 0.001 );
85+ $ this ->assertEqualsWithDelta (36.154 , $ result ->getCoordinates ()->getLatitude (), 0.001 );
86+ $ this ->assertEqualsWithDelta (-95.9928 , $ result ->getCoordinates ()->getLongitude (), 0.001 );
9187 $ this ->assertEquals (74101 , $ result ->getPostalCode ());
9288 $ this ->assertEquals ('Tulsa ' , $ result ->getLocality ());
9389 $ this ->assertCount (1 , $ result ->getAdminLevels ());
@@ -111,8 +107,8 @@ public function testGeocodeWithRealIPv6()
111107 /** @var Location $result */
112108 $ result = $ results ->first ();
113109 $ this ->assertInstanceOf ('\Geocoder\Model\Address ' , $ result );
114- $ this ->assertEquals (36.154 , $ result ->getCoordinates ()->getLatitude (), '' , 0.001 );
115- $ this ->assertEquals (-95.9928 , $ result ->getCoordinates ()->getLongitude (), '' , 0.001 );
110+ $ this ->assertEqualsWithDelta (36.154 , $ result ->getCoordinates ()->getLatitude (), 0.001 );
111+ $ this ->assertEqualsWithDelta (-95.9928 , $ result ->getCoordinates ()->getLongitude (), 0.001 );
116112 $ this ->assertEquals (74101 , $ result ->getPostalCode ());
117113 $ this ->assertEquals ('Tulsa ' , $ result ->getLocality ());
118114 $ this ->assertCount (1 , $ result ->getAdminLevels ());
@@ -121,12 +117,11 @@ public function testGeocodeWithRealIPv6()
121117 $ this ->assertEquals ('US ' , $ result ->getCountry ()->getCode ());
122118 }
123119
124- /**
125- * @expectedException \Geocoder\Exception\UnsupportedOperation
126- * @expectedExceptionMessage The IP2Location provider is not able to do reverse geocoding.
127- */
128120 public function testReverse ()
129121 {
122+ $ this ->expectException (\Geocoder \Exception \UnsupportedOperation::class);
123+ $ this ->expectExceptionMessage ('The IP2Location provider is not able to do reverse geocoding. ' );
124+
130125 $ provider = new IP2Location ($ this ->getMockedHttpClient (), 'api_key ' );
131126 $ provider ->reverseQuery (ReverseQuery::fromCoordinates (0 , 0 ));
132127 }
0 commit comments