From 31cd428894e27a79c69c07a201e84ecd264d1d21 Mon Sep 17 00:00:00 2001 From: fbuchlak <30214087+fbuchlak@users.noreply.github.com> Date: Sun, 23 Mar 2025 09:50:35 +0100 Subject: [PATCH 1/2] style: convert string class names to constants --- .../AlgoliaPlaces/Tests/AlgoliaPlacesTest.php | 10 ++-- .../ArcGISOnline/Tests/ArcGISOnlineTest.php | 24 ++++----- src/Provider/BingMaps/Tests/BingMapsTest.php | 22 ++++---- src/Provider/Chain/Tests/ChainTest.php | 8 +-- .../FreeGeoIp/Tests/FreeGeoIpTest.php | 34 ++++++------ .../GeoIP2/Tests/GeoIP2AdapterTest.php | 4 +- src/Provider/GeoIP2/Tests/GeoIP2Test.php | 8 +-- src/Provider/GeoIPs/Tests/GeoIPsTest.php | 16 +++--- .../GeoPlugin/Tests/GeoPluginTest.php | 6 +-- .../GeocodeEarth/Tests/GeocodeEarthTest.php | 30 +++++------ src/Provider/Geoip/Tests/GeoipTest.php | 4 +- .../Geonames/Tests/CountryInfoTest.php | 4 +- src/Provider/Geonames/Tests/GeonamesTest.php | 36 ++++++------- .../GoogleMaps/Tests/GoogleMapsTest.php | 4 +- .../GraphHopper/Tests/GraphHopperTest.php | 18 +++---- src/Provider/Here/Tests/HereTest.php | 30 +++++------ src/Provider/HostIp/Tests/HostIpTest.php | 12 ++--- src/Provider/HostIp/Tests/HostIpXmlTest.php | 12 ++--- .../IP2Location/Tests/IP2LocationTest.php | 8 +-- .../Tests/IP2LocationBinaryTest.php | 16 +++--- src/Provider/IpInfo/Tests/IpInfoTest.php | 12 ++--- src/Provider/IpInfoDb/Tests/IpInfoDbTest.php | 12 ++--- src/Provider/Ipstack/Tests/IpstackTest.php | 16 +++--- .../LocationIQ/Tests/LocationIQTest.php | 4 +- src/Provider/MapQuest/Tests/MapQuestTest.php | 54 +++++++++---------- src/Provider/MapTiler/Tests/MapTilerTest.php | 12 ++--- src/Provider/Mapzen/Tests/MapzenTest.php | 24 ++++----- src/Provider/MaxMind/Tests/MaxMindTest.php | 36 ++++++------- .../MaxMindBinary/Tests/MaxMindBinaryTest.php | 14 ++--- .../Nominatim/Tests/NominatimTest.php | 26 ++++----- .../Tests/OpenRouteServiceTest.php | 26 ++++----- src/Provider/Photon/Tests/PhotonTest.php | 10 ++-- .../PickPoint/Tests/PickPointTest.php | 4 +- src/Provider/TomTom/Tests/TomTomTest.php | 16 +++--- src/Provider/Yandex/Tests/YandexTest.php | 50 ++++++++--------- 35 files changed, 311 insertions(+), 311 deletions(-) diff --git a/src/Provider/AlgoliaPlaces/Tests/AlgoliaPlacesTest.php b/src/Provider/AlgoliaPlaces/Tests/AlgoliaPlacesTest.php index 9428a45c6..31ca5b192 100644 --- a/src/Provider/AlgoliaPlaces/Tests/AlgoliaPlacesTest.php +++ b/src/Provider/AlgoliaPlaces/Tests/AlgoliaPlacesTest.php @@ -47,12 +47,12 @@ public function testGeocodeQueryWithLocale(): void $provider = new AlgoliaPlaces($this->getHttpClient($_SERVER['ALGOLIA_API_KEY'], $_SERVER['ALGOLIA_APP_ID']), $_SERVER['ALGOLIA_API_KEY'], $_SERVER['ALGOLIA_APP_ID']); $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')->withLocale('fr-FR')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.8653, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.39844, $result->getCoordinates()->getLongitude(), 0.01); @@ -72,12 +72,12 @@ public function testGeocodeQueryWithoutLocale(): void $provider = new AlgoliaPlaces($this->getHttpClient($_SERVER['ALGOLIA_API_KEY'], $_SERVER['ALGOLIA_APP_ID']), $_SERVER['ALGOLIA_API_KEY'], $_SERVER['ALGOLIA_APP_ID']); $results = $provider->geocodeQuery(GeocodeQuery::create('Paris, France')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(20, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.8546, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.34771, $result->getCoordinates()->getLongitude(), 0.01); @@ -93,7 +93,7 @@ public function testGeocodeUnauthenticated(): void $provider = new AlgoliaPlaces($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('Paris, France')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(20, $results); } diff --git a/src/Provider/ArcGISOnline/Tests/ArcGISOnlineTest.php b/src/Provider/ArcGISOnline/Tests/ArcGISOnlineTest.php index c8d0f760c..b202df83a 100644 --- a/src/Provider/ArcGISOnline/Tests/ArcGISOnlineTest.php +++ b/src/Provider/ArcGISOnline/Tests/ArcGISOnlineTest.php @@ -55,12 +55,12 @@ public function testGeocodeWithRealAddress(): void $provider = new ArcGISOnline($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.863279997000461, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(2.3890199980004354, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertEquals(10, $result->getStreetNumber()); @@ -88,11 +88,11 @@ public function testGeocodeWithToken(): void $provider = ArcGISOnline::token($this->getHttpClient($_SERVER['ARCGIS_TOKEN']), $_SERVER['ARCGIS_TOKEN']); $results = $provider->geocodeQuery(GeocodeQuery::create('5754 WI-23, Spring Green, WI 53588, USA')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(43.093663, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(-90.131796, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertEquals(5754, $result->getStreetNumber()); @@ -126,12 +126,12 @@ public function testReverseWithRealCoordinates(): void $provider = new ArcGISOnline($this->getHttpClient(), null); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.863279997000461, 2.3890199980004354)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.863279997000461, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(2.3890199980004354, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetNumber()); @@ -152,12 +152,12 @@ public function testGeocodeWithCity(): void $provider = new ArcGISOnline($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('Hannover')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.37227000000007, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(9.738150000000076, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetNumber()); @@ -175,7 +175,7 @@ public function testGeocodeWithCity(): void /** @var Location $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(39.391768472000479, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(-77.440257128999633, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetName()); @@ -186,7 +186,7 @@ public function testGeocodeWithCity(): void /** @var Location $result */ $result = $results->get(2); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(53.174198173, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(8.5069383810005, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetName()); @@ -197,7 +197,7 @@ public function testGeocodeWithCity(): void /** @var Location $result */ $result = $results->get(3); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(47.111290000000054, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(-101.42142999999999, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetName()); @@ -208,7 +208,7 @@ public function testGeocodeWithCity(): void /** @var Location $result */ $result = $results->get(4); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(32.518790000000024, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(-90.06298999999996, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetName()); diff --git a/src/Provider/BingMaps/Tests/BingMapsTest.php b/src/Provider/BingMaps/Tests/BingMapsTest.php index 7efad170e..dc93b5ec1 100644 --- a/src/Provider/BingMaps/Tests/BingMapsTest.php +++ b/src/Provider/BingMaps/Tests/BingMapsTest.php @@ -70,12 +70,12 @@ public function testGeocodeReturnsMultipleResults(): void $provider = new BingMaps($this->getMockedHttpClient($json), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(3, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.86321675999999, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.3887721299999995, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -97,7 +97,7 @@ public function testGeocodeReturnsMultipleResults(): void /** @var Location $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.81342781, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.32503767, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -117,7 +117,7 @@ public function testGeocodeReturnsMultipleResults(): void /** @var Location $result */ $result = $results->get(2); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.81014147, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.43568048, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -145,12 +145,12 @@ public function testReverseReturnsSingleResult(): void $provider = new BingMaps($this->getMockedHttpClient($json), 'api_key'); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.86321648955345, 2.3887719959020615)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.86321648955345, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(2.3887719959020615, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNotNull($result->getBounds()); @@ -180,12 +180,12 @@ public function testGeocodeWithRealAddressReturnsSingleResults(): void $provider = new BingMaps($this->getHttpClient($_SERVER['BINGMAPS_API_KEY']), $_SERVER['BINGMAPS_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')->withLocale('fr-FR')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.86321675999999, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.3887721299999995, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -217,7 +217,7 @@ public function testGeocodeWithRealAddressReturnsMultipleResults(): void $provider = new BingMaps($this->getHttpClient($_SERVER['BINGMAPS_API_KEY']), $_SERVER['BINGMAPS_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Castelnuovo, Italie')->withLocale('fr-FR')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); } @@ -230,12 +230,12 @@ public function testReverseWithRealCoordinatesReturnsSingleResult(): void $provider = new BingMaps($this->getHttpClient($_SERVER['BINGMAPS_API_KEY']), $_SERVER['BINGMAPS_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.86321648955345, 2.3887719959020615)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.86321648955345, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(2.3887719959020615, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNotNull($result->getBounds()); diff --git a/src/Provider/Chain/Tests/ChainTest.php b/src/Provider/Chain/Tests/ChainTest.php index 230986c4e..6a4d2454a 100644 --- a/src/Provider/Chain/Tests/ChainTest.php +++ b/src/Provider/Chain/Tests/ChainTest.php @@ -27,7 +27,7 @@ class ChainTest extends TestCase { public function testAdd(): void { - $mock = $this->getMockBuilder('Geocoder\Provider\Provider')->getMock(); + $mock = $this->getMockBuilder(\Geocoder\Provider\Provider::class)->getMock(); $chain = new Chain(); $chain->add($mock); @@ -49,7 +49,7 @@ public function testReverse(): void throw new \Exception(); })); - $mockTwo = $this->getMockBuilder('Geocoder\\Provider\\Provider')->getMock(); + $mockTwo = $this->getMockBuilder(\Geocoder\Provider\Provider::class)->getMock(); $result = new AddressCollection(['foo' => 'bar']); $mockTwo->expects($this->once()) ->method('reverseQuery') @@ -63,14 +63,14 @@ public function testReverse(): void public function testGeocode(): void { $query = GeocodeQuery::create('Paris'); - $mockOne = $this->getMockBuilder('Geocoder\\Provider\\Provider')->getMock(); + $mockOne = $this->getMockBuilder(\Geocoder\Provider\Provider::class)->getMock(); $mockOne->expects($this->once()) ->method('geocodeQuery') ->will($this->returnCallback(function () { throw new \Exception(); })); - $mockTwo = $this->getMockBuilder('Geocoder\\Provider\\Provider')->getMock(); + $mockTwo = $this->getMockBuilder(\Geocoder\Provider\Provider::class)->getMock(); $result = new AddressCollection(['foo' => 'bar']); $mockTwo->expects($this->once()) ->method('geocodeQuery') diff --git a/src/Provider/FreeGeoIp/Tests/FreeGeoIpTest.php b/src/Provider/FreeGeoIp/Tests/FreeGeoIpTest.php index 4c4eacc44..b0444d401 100644 --- a/src/Provider/FreeGeoIp/Tests/FreeGeoIpTest.php +++ b/src/Provider/FreeGeoIp/Tests/FreeGeoIpTest.php @@ -45,12 +45,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('localhost', $result->getLocality()); $this->assertEquals('localhost', $result->getCountry()->getName()); } @@ -60,12 +60,12 @@ public function testGeocodeWithLocalhostIPv6(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('::1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('localhost', $result->getLocality()); $this->assertEquals('localhost', $result->getCountry()->getName()); } @@ -75,12 +75,12 @@ public function testGeocodeWithRealIPv4(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('74.200.247.59')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(37.751, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-97.822, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('United States', $result->getCountry()->getName()); @@ -92,12 +92,12 @@ public function testGeocodeWithRealIPv6(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('::ffff:74.200.247.59')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(37.751, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-97.822, $result->getCoordinates()->getLongitude(), 0.01); @@ -110,12 +110,12 @@ public function testGeocodeWithUSIPv4(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('72.229.28.185')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.7263, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-73.9819, $result->getCoordinates()->getLongitude(), 0.01); @@ -133,12 +133,12 @@ public function testGeocodeWithUSIPv6(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('::ffff:74.200.247.59')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('United States', $result->getCountry()->getName()); $this->assertEquals('US', $result->getCountry()->getCode()); @@ -149,7 +149,7 @@ public function testGeocodeWithUKIPv4(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('129.67.242.154')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); $this->assertEquals('GB', $results->first()->getCountry()->getCode()); @@ -163,7 +163,7 @@ public function testGeocodeWithUKIPv6(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('::ffff:129.67.242.154')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); $this->assertEquals('GB', $results->first()->getCountry()->getCode()); } @@ -173,7 +173,7 @@ public function testGeocodeWithRuLocale(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('81.27.51.253')->withLocale('ru')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); $this->assertEquals('Владимирская область', $results->first()->getAdminLevels()->first()->getName()); $this->assertEquals('Владимир', $results->first()->getLocality()); @@ -185,7 +185,7 @@ public function testGeocodeWithFrLocale(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('81.27.51.252')->withLocale('fr')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); $this->assertEquals('Oblast de Vladimir', $results->first()->getAdminLevels()->first()->getName()); $this->assertEquals('Vladimir', $results->first()->getLocality()); @@ -197,7 +197,7 @@ public function testGeocodeWithIncorrectLocale(): void $provider = $this->getProvider(); $results = $provider->geocodeQuery(GeocodeQuery::create('81.27.51.251')->withLocale('wrong_locale')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); $this->assertEquals('Vladimirskaya Oblast\'', $results->first()->getAdminLevels()->first()->getName()); $this->assertEquals('Vladimir', $results->first()->getLocality()); diff --git a/src/Provider/GeoIP2/Tests/GeoIP2AdapterTest.php b/src/Provider/GeoIP2/Tests/GeoIP2AdapterTest.php index 1a3be5cac..d052ac89c 100644 --- a/src/Provider/GeoIP2/Tests/GeoIP2AdapterTest.php +++ b/src/Provider/GeoIP2/Tests/GeoIP2AdapterTest.php @@ -31,7 +31,7 @@ class GeoIP2AdapterTest extends TestCase */ public static function setUpBeforeClass(): void { - if (false === class_exists('\GeoIp2\Database\Reader')) { + if (false === class_exists(\GeoIp2\Database\Reader::class)) { throw new \RuntimeException("The maxmind's lib 'geoip2/geoip2' is required to run this test."); } } @@ -126,7 +126,7 @@ public function testReaderResponseIsJsonEncoded(): void */ protected function getGeoIP2ProviderMock() { - $mock = $this->getMockBuilder('\GeoIp2\ProviderInterface')->getMock(); + $mock = $this->getMockBuilder(\GeoIp2\ProviderInterface::class)->getMock(); return $mock; } diff --git a/src/Provider/GeoIP2/Tests/GeoIP2Test.php b/src/Provider/GeoIP2/Tests/GeoIP2Test.php index 3ce72e465..bc0885452 100644 --- a/src/Provider/GeoIP2/Tests/GeoIP2Test.php +++ b/src/Provider/GeoIP2/Tests/GeoIP2Test.php @@ -63,12 +63,12 @@ public function testGeocodeWithLocalhostIPv4(): void { $results = $this->provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('localhost', $result->getLocality()); $this->assertEquals('localhost', $result->getCountry()->getName()); } @@ -172,12 +172,12 @@ public function testRetrievingGeodata(string $address, string $adapterResponse, $results = $provider->geocodeQuery(GeocodeQuery::create($address)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); if (isset($expectedGeodata['latitude'])) { $this->assertEquals($expectedGeodata['latitude'], $result->getCoordinates()->getLatitude()); $this->assertEquals($expectedGeodata['longitude'], $result->getCoordinates()->getLongitude()); diff --git a/src/Provider/GeoIPs/Tests/GeoIPsTest.php b/src/Provider/GeoIPs/Tests/GeoIPsTest.php index 6dfa13dfa..72136e56b 100644 --- a/src/Provider/GeoIPs/Tests/GeoIPsTest.php +++ b/src/Provider/GeoIPs/Tests/GeoIPsTest.php @@ -46,12 +46,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new GeoIPs($this->getMockedHttpClient(), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('localhost', $result->getLocality()); $this->assertEquals('localhost', $result->getCountry()->getName()); } @@ -112,12 +112,12 @@ public function testGeocodeWithRealIPv4GetsFakeContentFormattedEmpty(): void $provider = new GeoIPs($this->getMockedHttpClient($json), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('66.147.244.214')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); @@ -154,12 +154,12 @@ public function testGeocodeWithRealIPv4GetsFakeContent(): void $provider = new GeoIPs($this->getMockedHttpClient($json), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('66.147.244.214')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.3402, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(-111.6073, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetName()); @@ -308,12 +308,12 @@ public function testGeocodeWithRealIPv4(): void $provider = new GeoIPs($this->getHttpClient($_SERVER['GEOIPS_API_KEY']), $_SERVER['GEOIPS_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('66.147.244.214')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.3402, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(-111.6073, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetName()); diff --git a/src/Provider/GeoPlugin/Tests/GeoPluginTest.php b/src/Provider/GeoPlugin/Tests/GeoPluginTest.php index 36c151e1f..3cbb39aff 100644 --- a/src/Provider/GeoPlugin/Tests/GeoPluginTest.php +++ b/src/Provider/GeoPlugin/Tests/GeoPluginTest.php @@ -44,7 +44,7 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new GeoPlugin($this->getMockedHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); $result = $results->first(); @@ -57,7 +57,7 @@ public function testGeocodeWithLocalhostIPv6(): void $provider = new GeoPlugin($this->getMockedHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('::1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); $result = $results->first(); @@ -70,7 +70,7 @@ public function testGeocodeWithRealIPv4(): void $provider = new GeoPlugin($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('66.147.244.214')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); $result = $results->first(); diff --git a/src/Provider/GeocodeEarth/Tests/GeocodeEarthTest.php b/src/Provider/GeocodeEarth/Tests/GeocodeEarthTest.php index ec72b5383..a6da7b2b6 100644 --- a/src/Provider/GeocodeEarth/Tests/GeocodeEarthTest.php +++ b/src/Provider/GeocodeEarth/Tests/GeocodeEarthTest.php @@ -49,12 +49,12 @@ public function testGeocodeWithRealAddress(): void $provider = new GeocodeEarth($this->getHttpClient($_SERVER['GEOCODE_EARTH_API_KEY']), $_SERVER['GEOCODE_EARTH_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('242 Acklam Road, London, United Kingdom')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.521124, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.20360200000000001, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Acklam Road', $result->getStreetName()); @@ -74,12 +74,12 @@ public function testReverseWithRealCoordinates(): void $provider = new GeocodeEarth($this->getHttpClient($_SERVER['GEOCODE_EARTH_API_KEY']), $_SERVER['GEOCODE_EARTH_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(54.0484068, -2.7990345)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(54.048411999999999, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-2.7989549999999999, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals(1, $result->getStreetNumber()); @@ -102,12 +102,12 @@ public function testReverseWithVillage(): void $provider = new GeocodeEarth($this->getHttpClient($_SERVER['GEOCODE_EARTH_API_KEY']), $_SERVER['GEOCODE_EARTH_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(49.1390924, 1.6572462)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('Bray-et-Lû', $result->getLocality()); } @@ -120,12 +120,12 @@ public function testGeocodeWithCity(): void $provider = new GeocodeEarth($this->getHttpClient($_SERVER['GEOCODE_EARTH_API_KEY']), $_SERVER['GEOCODE_EARTH_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Hanover')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.379952, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(9.787455, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -136,7 +136,7 @@ public function testGeocodeWithCity(): void /** @var \Geocoder\Model\Address $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.37362, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(9.73711, $result->getCoordinates()->getLongitude(), 0.01); $this->assertCount(3, $result->getAdminLevels()); @@ -145,7 +145,7 @@ public function testGeocodeWithCity(): void /** @var \Geocoder\Model\Address $result */ $result = $results->get(2); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(18.393428, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-78.107687, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNull($result->getLocality()); @@ -155,7 +155,7 @@ public function testGeocodeWithCity(): void /** @var \Geocoder\Model\Address $result */ $result = $results->get(3); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(39.192889999999998, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-76.724140000000006, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -173,12 +173,12 @@ public function testGeocodeWithCityDistrict(): void $provider = new GeocodeEarth($this->getHttpClient($_SERVER['GEOCODE_EARTH_API_KEY']), $_SERVER['GEOCODE_EARTH_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Kalbacher Hauptstraße 10, 60437 Frankfurt, Germany')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(2, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(50.189017, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(8.6367809999999992, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('10a', $result->getStreetNumber()); @@ -202,12 +202,12 @@ public function testGeocodeNoBounds(): void $provider = new GeocodeEarth($this->getHttpClient($_SERVER['GEOCODE_EARTH_API_KEY']), $_SERVER['GEOCODE_EARTH_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('dworzec centralny')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.230428, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(21.004552, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Warsaw', $result->getLocality()); diff --git a/src/Provider/Geoip/Tests/GeoipTest.php b/src/Provider/Geoip/Tests/GeoipTest.php index bb3e41626..28d1c3727 100644 --- a/src/Provider/Geoip/Tests/GeoipTest.php +++ b/src/Provider/Geoip/Tests/GeoipTest.php @@ -52,12 +52,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new Geoip(); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); diff --git a/src/Provider/Geonames/Tests/CountryInfoTest.php b/src/Provider/Geonames/Tests/CountryInfoTest.php index efcb198da..a613df528 100644 --- a/src/Provider/Geonames/Tests/CountryInfoTest.php +++ b/src/Provider/Geonames/Tests/CountryInfoTest.php @@ -38,8 +38,8 @@ public function testCountryInfoWithOneCountry(): void /* @var CountryInfo $result */ $result = current($results); - $this->assertInstanceOf('Geocoder\Provider\Geonames\Model\CountryInfo', $result); - $this->assertInstanceOf('Geocoder\Model\Bounds', $result->getBounds()); + $this->assertInstanceOf(\Geocoder\Provider\Geonames\Model\CountryInfo::class, $result); + $this->assertInstanceOf(\Geocoder\Model\Bounds::class, $result->getBounds()); $this->assertEquals('AS', $result->getContinent()); $this->assertEquals('New Delhi', $result->getCapital()); $this->assertIsArray($result->getLanguages()); diff --git a/src/Provider/Geonames/Tests/GeonamesTest.php b/src/Provider/Geonames/Tests/GeonamesTest.php index 8a9f7117e..9f6b1e06d 100644 --- a/src/Provider/Geonames/Tests/GeonamesTest.php +++ b/src/Provider/Geonames/Tests/GeonamesTest.php @@ -75,11 +75,11 @@ public function testGeocodeWithRealPlace(): void $provider = new Geonames($this->getHttpClient($_SERVER['GEONAMES_USERNAME']), $_SERVER['GEONAMES_USERNAME']); $results = $provider->geocodeQuery(GeocodeQuery::create('Harrods, London')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); /** @var GeonamesAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.49957, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.16359, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('United Kingdom', $result->getCountry()->getName()); @@ -104,12 +104,12 @@ public function testGeocodeWithMultipleRealPlaces(): void $provider = new Geonames($this->getHttpClient($_SERVER['GEONAMES_USERNAME']), $_SERVER['GEONAMES_USERNAME']); $results = $provider->geocodeQuery(GeocodeQuery::create('London')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.508528775863, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.12574195861816, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -127,7 +127,7 @@ public function testGeocodeWithMultipleRealPlaces(): void /** @var Location $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(-33.015285093464, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(27.911624908447, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -146,7 +146,7 @@ public function testGeocodeWithMultipleRealPlaces(): void /** @var Location $result */ $result = $results->get(2); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.512788890295, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.091838836669922, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -165,7 +165,7 @@ public function testGeocodeWithMultipleRealPlaces(): void /** @var Location $result */ $result = $results->get(3); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(42.983389283, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-81.233042387, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -182,7 +182,7 @@ public function testGeocodeWithMultipleRealPlaces(): void /** @var Location $result */ $result = $results->get(4); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(41.3556539, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-72.0995209, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -208,12 +208,12 @@ public function testGeocodeWithMultipleRealPlacesWithLocale(): void $provider = new Geonames($this->getHttpClient($_SERVER['GEONAMES_USERNAME']), $_SERVER['GEONAMES_USERNAME']); $results = $provider->geocodeQuery(GeocodeQuery::create('London')->withLocale('it_IT')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.50853, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.12574, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -231,7 +231,7 @@ public function testGeocodeWithMultipleRealPlacesWithLocale(): void /** @var Location $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(-33.015285093464, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(27.911624908447, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -250,7 +250,7 @@ public function testGeocodeWithMultipleRealPlacesWithLocale(): void /** @var Location $result */ $result = $results->get(2); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.512788890295, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.091838836669922, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -269,7 +269,7 @@ public function testGeocodeWithMultipleRealPlacesWithLocale(): void /** @var Location $result */ $result = $results->get(3); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(42.983389283, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-81.233042387, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -286,7 +286,7 @@ public function testGeocodeWithMultipleRealPlacesWithLocale(): void /** @var Location $result */ $result = $results->get(4); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(41.3556539, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-72.0995209, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -312,12 +312,12 @@ public function testReverseWithRealCoordinates(): void $provider = new Geonames($this->getHttpClient($_SERVER['GEONAMES_USERNAME']), $_SERVER['GEONAMES_USERNAME']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(51.50853, -0.12574)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.50853, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.12574, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('London', $result->getLocality()); @@ -338,12 +338,12 @@ public function testReverseWithRealCoordinatesWithLocale(): void $provider = new Geonames($this->getHttpClient($_SERVER['GEONAMES_USERNAME']), $_SERVER['GEONAMES_USERNAME']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(51.50853, -0.12574)->withLocale('it_IT')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.50853, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.12574, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Londra', $result->getLocality()); diff --git a/src/Provider/GoogleMaps/Tests/GoogleMapsTest.php b/src/Provider/GoogleMaps/Tests/GoogleMapsTest.php index d56d86b11..1e00b5ee1 100644 --- a/src/Provider/GoogleMaps/Tests/GoogleMapsTest.php +++ b/src/Provider/GoogleMaps/Tests/GoogleMapsTest.php @@ -528,7 +528,7 @@ public function testReverseWithSubLocalityLevels(): void /** @var GoogleAddress $result */ $result = $results->first(); $this->assertInstanceOf(Address::class, $result); - $this->assertInstanceOf('\Geocoder\Model\AdminLevelCollection', $result->getSubLocalityLevels()); + $this->assertInstanceOf(\Geocoder\Model\AdminLevelCollection::class, $result->getSubLocalityLevels()); $this->assertEquals('Iijima', $result->getSubLocalityLevels()->get(2)->getName()); $this->assertEquals(false, $result->isPartialMatch()); } @@ -584,7 +584,7 @@ public function testGeocodeDuplicateSubLocalityLevel(): void $this->assertCount(2, $result->getAdminLevels()); $this->assertEquals('Région Wallonne', $result->getAdminLevels()->get(1)->getName()); $this->assertEquals('Hainaut', $result->getAdminLevels()->get(2)->getName()); - $this->assertInstanceOf('\Geocoder\Model\AdminLevelCollection', $result->getSubLocalityLevels()); + $this->assertInstanceOf(\Geocoder\Model\AdminLevelCollection::class, $result->getSubLocalityLevels()); $this->assertEquals(1, $result->getSubLocalityLevels()->get(1)->getLevel()); $this->assertEquals('Wayaux / Les Bons Villers', $result->getSubLocalityLevels()->get(1)->getName()); $this->assertEquals('Wayaux / Les Bons Villers', $result->getSubLocalityLevels()->get(1)->getCode()); diff --git a/src/Provider/GraphHopper/Tests/GraphHopperTest.php b/src/Provider/GraphHopper/Tests/GraphHopperTest.php index 8d95a1456..c3c5b5626 100644 --- a/src/Provider/GraphHopper/Tests/GraphHopperTest.php +++ b/src/Provider/GraphHopper/Tests/GraphHopperTest.php @@ -43,12 +43,12 @@ public function testGeocodeWithRealAddress(): void $provider = new GraphHopper($this->getHttpClient($_SERVER['GRAPHHOPPER_API_KEY']), $_SERVER['GRAPHHOPPER_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('242 Acklam Road, London, United Kingdom')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.521124, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.20360200000000001, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Acklam Road', $result->getStreetName()); @@ -65,12 +65,12 @@ public function testGeocodeWithRealAddressAndLocale(): void $provider = new GraphHopper($this->getHttpClient($_SERVER['GRAPHHOPPER_API_KEY']), $_SERVER['GRAPHHOPPER_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('242 Acklam Road, London, United Kingdom')->withLocale('fr')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.521124, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.20360200000000001, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Acklam Road', $result->getStreetName()); @@ -90,12 +90,12 @@ public function testGeocodeInsideBounds(): void ->withLocale('fr') ->withBounds(new Bounds(50, -10, 55, 10)) ); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.521124, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.20360200000000001, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Acklam Road', $result->getStreetName()); @@ -115,7 +115,7 @@ public function testGeocodeOutsideBounds(): void ->withLocale('fr') ->withBounds(new Bounds(20, 10, 30, 20)) ); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(0, $results); } @@ -128,12 +128,12 @@ public function testReverseWithRealCoordinates(): void $provider = new GraphHopper($this->getHttpClient($_SERVER['GRAPHHOPPER_API_KEY']), $_SERVER['GRAPHHOPPER_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(54.0484068, -2.7990345)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(54.048411999999999, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-2.7989549999999999, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals('1', $result->getStreetNumber()); diff --git a/src/Provider/Here/Tests/HereTest.php b/src/Provider/Here/Tests/HereTest.php index 2f194eeca..3fc9412b5 100644 --- a/src/Provider/Here/Tests/HereTest.php +++ b/src/Provider/Here/Tests/HereTest.php @@ -44,12 +44,12 @@ public function testGeocodeWithRealAddress(): void $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')->withLocale('fr-FR')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.8653, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.39844, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -79,13 +79,13 @@ public function testGeocodeWithDefaultAdditionalData(): void $results = $provider->geocodeQuery(GeocodeQuery::create('Sant Roc, Santa Coloma de Cervelló, Espanya')->withLocale('ca')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var HereAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(41.37854, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.01196, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -125,12 +125,12 @@ public function testGeocodeWithAdditionalData(): void ->withData('IncludeRoutingInformation', 'true') ->withLocale('ca')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var HereAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(41.37854, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.01196, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -175,8 +175,8 @@ public function testGeocodeWithExtraFilterCountry(): void $resultsSpain = $provider->geocodeQuery($queryBarcelonaFromSpain); $resultsVenezuela = $provider->geocodeQuery($queryBarcelonaFromVenezuela); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsSpain); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsVenezuela); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $resultsSpain); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $resultsVenezuela); $this->assertCount(1, $resultsSpain); $this->assertCount(1, $resultsVenezuela); @@ -212,9 +212,9 @@ public function testGeocodeWithExtraFilterCity(): void $resultsCity2 = $provider->geocodeQuery($queryStreetCity2); $resultsCity3 = $provider->geocodeQuery($queryStreetCity3); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsCity1); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsCity2); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsCity3); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $resultsCity1); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $resultsCity2); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $resultsCity3); $resultCity1 = $resultsCity1->first(); $resultCity2 = $resultsCity2->first(); @@ -248,8 +248,8 @@ public function testGeocodeWithExtraFilterCounty(): void $resultsRegion1 = $provider->geocodeQuery($queryCityRegion1); $resultsRegion2 = $provider->geocodeQuery($queryCityRegion2); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsRegion1); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsRegion2); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $resultsRegion1); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $resultsRegion2); /** @var HereAddress $resultRegion1 */ $resultRegion1 = $resultsRegion1->first(); @@ -278,12 +278,12 @@ public function testReverseWithRealCoordinates(): void $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.8632156, 2.3887722)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.8632147, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(2.3887722, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNotNull($result->getBounds()); diff --git a/src/Provider/HostIp/Tests/HostIpTest.php b/src/Provider/HostIp/Tests/HostIpTest.php index 97f5450d4..7564441b0 100644 --- a/src/Provider/HostIp/Tests/HostIpTest.php +++ b/src/Provider/HostIp/Tests/HostIpTest.php @@ -45,12 +45,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new HostIp($this->getMockedHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); @@ -75,12 +75,12 @@ public function testGeocodeWithRealIPv4(): void $provider = new HostIp($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('88.188.221.14')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals(null, $result->getCoordinates()); $this->assertNull($result->getPostalCode()); $this->assertEquals('Aulnat', $result->getLocality()); @@ -112,12 +112,12 @@ public function testGeocodeWithAnotherIp(): void $provider = new HostIp($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('33.33.33.22')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); } } diff --git a/src/Provider/HostIp/Tests/HostIpXmlTest.php b/src/Provider/HostIp/Tests/HostIpXmlTest.php index 746c7bea0..524904be8 100644 --- a/src/Provider/HostIp/Tests/HostIpXmlTest.php +++ b/src/Provider/HostIp/Tests/HostIpXmlTest.php @@ -45,12 +45,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new HostIpXml($this->getMockedHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); @@ -75,12 +75,12 @@ public function testGeocodeWithRealIPv4(): void $provider = new HostIpXml($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('77.38.216.139')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(56.8833, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(24.0833, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getPostalCode()); @@ -113,12 +113,12 @@ public function testGeocodeWithAnotherIp(): void $provider = new HostIpXml($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('33.33.33.22')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); } } diff --git a/src/Provider/IP2Location/Tests/IP2LocationTest.php b/src/Provider/IP2Location/Tests/IP2LocationTest.php index 82bf8e052..244a55ebe 100644 --- a/src/Provider/IP2Location/Tests/IP2LocationTest.php +++ b/src/Provider/IP2Location/Tests/IP2LocationTest.php @@ -76,12 +76,12 @@ public function testGeocodeWithRealIPv4(): void $provider = new IP2Location($this->getHttpClient($_SERVER['IP2LOCATION_API_KEY']), $_SERVER['IP2LOCATION_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(36.154, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-95.9928, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals(74101, $result->getPostalCode()); @@ -101,12 +101,12 @@ public function testGeocodeWithRealIPv6(): void $provider = new IP2Location($this->getHttpClient($_SERVER['IP2LOCATION_API_KEY']), $_SERVER['IP2LOCATION_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('::ffff:74.125.45.100')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(36.154, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-95.9928, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals(74101, $result->getPostalCode()); diff --git a/src/Provider/IP2LocationBinary/Tests/IP2LocationBinaryTest.php b/src/Provider/IP2LocationBinary/Tests/IP2LocationBinaryTest.php index 6093e52c9..242c7bd5c 100644 --- a/src/Provider/IP2LocationBinary/Tests/IP2LocationBinaryTest.php +++ b/src/Provider/IP2LocationBinary/Tests/IP2LocationBinaryTest.php @@ -64,12 +64,12 @@ public function testLocationResultContainsExpectedFieldsForAnAmericanIp(): void $provider = new IP2LocationBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('8.8.8.8')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(37.405990600586, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-122.07851409912, $result->getCoordinates()->getLongitude(), 0.001); @@ -92,12 +92,12 @@ public function testLocationResultContainsExpectedFieldsForAChinaIp(): void $provider = new IP2LocationBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('123.123.123.123')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(39.907501220703, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(116.39723205566, $result->getCoordinates()->getLongitude(), 0.001); @@ -120,12 +120,12 @@ public function testGeocodeWithRealIPv6(): void $provider = new IP2LocationBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('2001:4860:4860::8888')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(37.386051, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-122.083847, $result->getCoordinates()->getLongitude(), 0.001); @@ -151,12 +151,12 @@ public function testFindLocationByIp(string $ip, ?string $expectedCity, ?string $provider = new IP2LocationBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create($ip)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals($expectedCity, $result->getLocality()); $this->assertEquals($expectedCountry, $result->getCountry()->getName()); } diff --git a/src/Provider/IpInfo/Tests/IpInfoTest.php b/src/Provider/IpInfo/Tests/IpInfoTest.php index 6346a7b3f..815f3cf15 100644 --- a/src/Provider/IpInfo/Tests/IpInfoTest.php +++ b/src/Provider/IpInfo/Tests/IpInfoTest.php @@ -55,12 +55,12 @@ public function testGeocodeWithLocalhost(string $localhostIp): void $provider = new IpInfo($this->getMockedHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create($localhostIp)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); @@ -93,12 +93,12 @@ public function testGeocodeWithRealIPv4(): void $provider = new IpInfo($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(36.154, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-95.9928, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals(74102, $result->getPostalCode()); @@ -115,12 +115,12 @@ public function testGeocodeWithRealIPv6(): void $provider = new IpInfo($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('2601:9:7680:363:75df:f491:6f85:352f')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(39.934, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-74.891, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals('08054', $result->getPostalCode()); diff --git a/src/Provider/IpInfoDb/Tests/IpInfoDbTest.php b/src/Provider/IpInfoDb/Tests/IpInfoDbTest.php index 56c1c7287..b30a1d9d5 100644 --- a/src/Provider/IpInfoDb/Tests/IpInfoDbTest.php +++ b/src/Provider/IpInfoDb/Tests/IpInfoDbTest.php @@ -62,12 +62,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); @@ -112,12 +112,12 @@ public function testGeocodeWithRealIPv4(): void $provider = new IpInfoDb($this->getHttpClient($_SERVER['IPINFODB_API_KEY']), $_SERVER['IPINFODB_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(36.154, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-95.9928, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals(74101, $result->getPostalCode()); @@ -154,12 +154,12 @@ public function testGetGeocodedDataWithCountryPrecision(): void $provider = new IpInfoDb($this->getHttpClient($_SERVER['IPINFODB_API_KEY']), $_SERVER['IPINFODB_API_KEY'], 'country'); $results = $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); diff --git a/src/Provider/Ipstack/Tests/IpstackTest.php b/src/Provider/Ipstack/Tests/IpstackTest.php index b7247ac59..34e8be77d 100644 --- a/src/Provider/Ipstack/Tests/IpstackTest.php +++ b/src/Provider/Ipstack/Tests/IpstackTest.php @@ -56,12 +56,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new Ipstack($this->getMockedHttpClient(), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('localhost', $result->getLocality()); $this->assertEquals('localhost', $result->getCountry()->getName()); $this->assertEmpty($result->getAdminLevels()); @@ -72,12 +72,12 @@ public function testGeocodeWithLocalhostIPv6(): void $provider = new Ipstack($this->getMockedHttpClient(), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('::1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('localhost', $result->getLocality()); $this->assertEquals('localhost', $result->getCountry()->getName()); $this->assertEmpty($result->getAdminLevels()); @@ -88,12 +88,12 @@ public function testGeocodeWithRealIPv4(): void $provider = new Ipstack($this->getHttpClient($_SERVER['IPSTACK_API_KEY']), $_SERVER['IPSTACK_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('74.200.247.59')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.724, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-74.059, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('United States', $result->getCountry()->getName()); @@ -107,12 +107,12 @@ public function testGeocodeWithRealIPv4InFrench(): void $provider = new Ipstack($this->getHttpClient($_SERVER['IPSTACK_API_KEY']), $_SERVER['IPSTACK_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('74.200.247.59')->withLocale('fr')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.724, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-74.059, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('États-Unis', $result->getCountry()->getName()); diff --git a/src/Provider/LocationIQ/Tests/LocationIQTest.php b/src/Provider/LocationIQ/Tests/LocationIQTest.php index 5c2ab151d..dc60da86b 100644 --- a/src/Provider/LocationIQ/Tests/LocationIQTest.php +++ b/src/Provider/LocationIQ/Tests/LocationIQTest.php @@ -79,12 +79,12 @@ public function testGetNodeStreetName(): void $provider = new LocationIQ($this->getHttpClient($_SERVER['LOCATIONIQ_API_KEY']), $_SERVER['LOCATIONIQ_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.86, 2.35)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('Rue Quincampoix', $result->getStreetName()); } } diff --git a/src/Provider/MapQuest/Tests/MapQuestTest.php b/src/Provider/MapQuest/Tests/MapQuestTest.php index c85a71f84..38b03982c 100644 --- a/src/Provider/MapQuest/Tests/MapQuestTest.php +++ b/src/Provider/MapQuest/Tests/MapQuestTest.php @@ -67,12 +67,12 @@ public function testGeocodeWithRealAddress(): void $provider = new MapQuest($this->getHttpClient($_SERVER['MAPQUEST_API_KEY']), $_SERVER['MAPQUEST_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(2, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.866205, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.389089, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('10 Avenue Gambetta', $result->getStreetName()); @@ -90,7 +90,7 @@ public function testGeocodeWithRealAddress(): void $this->assertNull($result->getTimezone()); $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.810071, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.435937, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('10 Avenue Gambetta', $result->getStreetName()); @@ -134,12 +134,12 @@ public function testGeocodeWithRealSpecificAddress(): void $query = $query->withData(MapQuest::DATA_KEY_ADDRESS, $address); $results = $provider->geocodeQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(36.062933, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-86.672811, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Payne Road', $result->getStreetName()); @@ -166,12 +166,12 @@ public function testReverseWithRealCoordinates(): void $provider = new MapQuest($this->getHttpClient($_SERVER['MAPQUEST_API_KEY']), $_SERVER['MAPQUEST_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(54.0484068, -2.7990345)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(54.0484068, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-2.7990345, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals('Collegian W.M.C.', $result->getStreetName()); @@ -197,14 +197,14 @@ public function testGeocodeWithCity(): void $provider = new MapQuest($this->getHttpClient($_SERVER['MAPQUEST_API_KEY']), $_SERVER['MAPQUEST_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Hanover')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); $resultsArray = $results->all(); /** @var Location $result */ $result = reset($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.374478, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(9.738553, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -216,7 +216,7 @@ public function testGeocodeWithCity(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(18.384049, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-78.131485, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('', $result->getLocality()); @@ -227,7 +227,7 @@ public function testGeocodeWithCity(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(43.703622, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-72.288666, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -239,7 +239,7 @@ public function testGeocodeWithCity(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(39.806325, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-76.984273, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -251,7 +251,7 @@ public function testGeocodeWithCity(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(37.744783, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-77.446416, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('', $result->getLocality()); @@ -278,14 +278,14 @@ public function testGeocodeWithSpecificCity(): void $query = $query->withData(MapQuest::DATA_KEY_ADDRESS, $address); $results = $provider->geocodeQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); $resultsArray = $results->all(); /** @var Location $result */ $result = reset($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.374478, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(9.738553, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -297,7 +297,7 @@ public function testGeocodeWithSpecificCity(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(43.703622, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-72.288666, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -309,7 +309,7 @@ public function testGeocodeWithSpecificCity(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(39.806325, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-76.984273, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -321,7 +321,7 @@ public function testGeocodeWithSpecificCity(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.661764, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-75.412404, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -333,7 +333,7 @@ public function testGeocodeWithSpecificCity(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.651401, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-75.440663, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -361,14 +361,14 @@ public function testGeocodeWithSpecificCityAndBounds(): void $query = $query->withBounds(new Bounds(39, -77, 41, -75)); $results = $provider->geocodeQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); $resultsArray = $results->all(); /** @var Location $result */ $result = reset($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('17331', $result->getPostalCode()); $this->assertEqualsWithDelta(39.806325, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-76.984273, $result->getCoordinates()->getLongitude(), 0.01); @@ -381,7 +381,7 @@ public function testGeocodeWithSpecificCityAndBounds(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.661764, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-75.412404, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -393,7 +393,7 @@ public function testGeocodeWithSpecificCityAndBounds(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.651401, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-75.440663, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -405,7 +405,7 @@ public function testGeocodeWithSpecificCityAndBounds(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('20794:21076', $result->getPostalCode()); $this->assertEqualsWithDelta(39.192885, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-76.724137, $result->getCoordinates()->getLongitude(), 0.01); @@ -418,7 +418,7 @@ public function testGeocodeWithSpecificCityAndBounds(): void /** @var Location $result */ $result = next($resultsArray); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.374478, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(9.738553, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -438,12 +438,12 @@ public function testGeocodeWithCityDistrict(): void $provider = new MapQuest($this->getHttpClient($_SERVER['MAPQUEST_API_KEY']), $_SERVER['MAPQUEST_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Kalbacher Hauptstraße 10, 60437 Frankfurt, Germany')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(50.189062, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(8.636567, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Kalbacher Hauptstraße 10', $result->getStreetName()); diff --git a/src/Provider/MapTiler/Tests/MapTilerTest.php b/src/Provider/MapTiler/Tests/MapTilerTest.php index 3bef6143f..c0e1ee6c3 100644 --- a/src/Provider/MapTiler/Tests/MapTilerTest.php +++ b/src/Provider/MapTiler/Tests/MapTilerTest.php @@ -79,12 +79,12 @@ public function testGeocodeQueryStreet(): void $provider = new MapTiler($this->getHttpClient($_SERVER['MAPTILER_KEY']), $_SERVER['MAPTILER_KEY']); $results = $provider->geocodeQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); // $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.8658863, $result->getCoordinates()->getLatitude(), 0.00001); $this->assertEqualsWithDelta(2.3993232, $result->getCoordinates()->getLongitude(), 0.00001); $this->assertEquals('Avenue Gambetta', $result->getStreetName()); @@ -103,12 +103,12 @@ public function testGeocodeQueryCity(): void $provider = new MapTiler($this->getHttpClient($_SERVER['MAPTILER_KEY']), $_SERVER['MAPTILER_KEY']); $results = $provider->geocodeQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); // $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.85881, $result->getCoordinates()->getLatitude(), 0.00001); $this->assertEqualsWithDelta(2.320031, $result->getCoordinates()->getLongitude(), 0.00001); $this->assertEquals('Paris', $result->getLocality()); @@ -126,12 +126,12 @@ public function testReverseQuery(): void $provider = new MapTiler($this->getHttpClient($_SERVER['MAPTILER_KEY']), $_SERVER['MAPTILER_KEY']); $results = $provider->reverseQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); // $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(47.3774434, $result->getCoordinates()->getLatitude(), 0.00001); $this->assertEqualsWithDelta(8.528509, $result->getCoordinates()->getLongitude(), 0.00001); $this->assertEquals('Zurich', $result->getLocality()); diff --git a/src/Provider/Mapzen/Tests/MapzenTest.php b/src/Provider/Mapzen/Tests/MapzenTest.php index 89354174b..ddc2892c3 100644 --- a/src/Provider/Mapzen/Tests/MapzenTest.php +++ b/src/Provider/Mapzen/Tests/MapzenTest.php @@ -61,12 +61,12 @@ public function testGeocodeWithRealAddress(): void $provider = new Mapzen($this->getHttpClient($_SERVER['MAPZEN_API_KEY']), $_SERVER['MAPZEN_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('242 Acklam Road, London, United Kingdom')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.521124, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.20360200000000001, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Acklam Road', $result->getStreetName()); @@ -87,12 +87,12 @@ public function testReverseWithRealCoordinates(): void $provider = new Mapzen($this->getHttpClient($_SERVER['MAPZEN_API_KEY']), $_SERVER['MAPZEN_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(54.0484068, -2.7990345)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(54.048411999999999, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-2.7989549999999999, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getStreetNumber()); @@ -115,12 +115,12 @@ public function testReverseWithVillage(): void $provider = new Mapzen($this->getHttpClient($_SERVER['MAPZEN_API_KEY']), $_SERVER['MAPZEN_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(49.1390924, 1.6572462)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('Bus-Saint-Rémy', $result->getLocality()); } @@ -133,12 +133,12 @@ public function testGeocodeWithCity(): void $provider = new Mapzen($this->getHttpClient($_SERVER['MAPZEN_API_KEY']), $_SERVER['MAPZEN_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Hanover')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(42.027323000000003, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-88.204203000000007, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNull($result->getLocality()); @@ -149,7 +149,7 @@ public function testGeocodeWithCity(): void /** @var \Geocoder\Model\Address $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(18.393428, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-78.122906, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNull($result->getLocality()); @@ -159,7 +159,7 @@ public function testGeocodeWithCity(): void /** @var \Geocoder\Model\Address $result */ $result = $results->get(2); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(39.192889999999998, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-76.724140000000006, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -177,12 +177,12 @@ public function testGeocodeWithCityDistrict(): void $provider = new Mapzen($this->getHttpClient($_SERVER['MAPZEN_API_KEY']), $_SERVER['MAPZEN_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Kalbacher Hauptstraße 10, 60437 Frankfurt, Germany')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(2, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(50.189017, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(8.6367809999999992, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('10a', $result->getStreetNumber()); diff --git a/src/Provider/MaxMind/Tests/MaxMindTest.php b/src/Provider/MaxMind/Tests/MaxMindTest.php index 2a3e7b416..9b796932f 100644 --- a/src/Provider/MaxMind/Tests/MaxMindTest.php +++ b/src/Provider/MaxMind/Tests/MaxMindTest.php @@ -46,12 +46,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new MaxMind($this->getMockedHttpClient(), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('localhost', $result->getLocality()); $this->assertEquals('localhost', $result->getCountry()->getName()); } @@ -61,12 +61,12 @@ public function testGeocodeWithLocalhostIPv6(): void $provider = new MaxMind($this->getMockedHttpClient(), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('::1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('localhost', $result->getLocality()); $this->assertEquals('localhost', $result->getCountry()->getName()); } @@ -94,12 +94,12 @@ public function testGeocodeWithRealIPv4GetsFakeContentFormattedEmpty(): void $provider = new MaxMind($this->getMockedHttpClient(',,,,,,,,,'), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('74.200.247.59')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getStreetNumber()); @@ -119,12 +119,12 @@ public function testGeocodeWithRealIPv4GetsFakeContent(): void ), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('74.200.247.59')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(33.034698486328, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(-96.813400268555, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetNumber()); @@ -151,12 +151,12 @@ public function testGeocodeWithRealIPv4GetsFakeContent(): void ), 'api_key'); $results = $provider4->geocodeQuery(GeocodeQuery::create('74.200.247.59')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(37.748402, $result->getCoordinates()->getLatitude(), 0.0001); $this->assertEqualsWithDelta(-122.415604, $result->getCoordinates()->getLongitude(), 0.0001); $this->assertNull($result->getStreetNumber()); @@ -263,12 +263,12 @@ public function testGeocodeServiceWithRealIPv4(): void $provider = new MaxMind($this->getHttpClient($_SERVER['MAXMIND_API_KEY']), $_SERVER['MAXMIND_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('74.200.247.159')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(33.034698, $result->getCoordinates()->getLatitude(), 0.1); $this->assertEqualsWithDelta(-96.813400, $result->getCoordinates()->getLongitude(), 0.1); $this->assertNull($result->getBounds()); @@ -297,12 +297,12 @@ public function testGeocodeOmniServiceWithRealIPv4(): void ); $results = $provider->geocodeQuery(GeocodeQuery::create('74.200.247.159')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(33.0347, $result->getCoordinates()->getLatitude(), 0.1); $this->assertEqualsWithDelta(-96.8134, $result->getCoordinates()->getLongitude(), 0.1); $this->assertNull($result->getBounds()); @@ -332,12 +332,12 @@ public function testGeocodeOmniServiceWithRealIPv4WithSslAndEncoding(): void ); $results = $provider->geocodeQuery(GeocodeQuery::create('189.26.128.80')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(-27.5833, $result->getCoordinates()->getLatitude(), 0.1); $this->assertEqualsWithDelta(-48.5666, $result->getCoordinates()->getLongitude(), 0.1); $this->assertNull($result->getBounds()); @@ -367,12 +367,12 @@ public function testGeocodeOmniServiceWithRealIPv6WithSsl(): void ); $results = $provider->geocodeQuery(GeocodeQuery::create('2002:4293:f4d6:0:0:0:0:0')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(40.2181, $result->getCoordinates()->getLatitude(), 0.1); $this->assertEqualsWithDelta(-111.6133, $result->getCoordinates()->getLongitude(), 0.1); $this->assertNull($result->getBounds()); diff --git a/src/Provider/MaxMindBinary/Tests/MaxMindBinaryTest.php b/src/Provider/MaxMindBinary/Tests/MaxMindBinaryTest.php index af87f76a5..dca752eb9 100644 --- a/src/Provider/MaxMindBinary/Tests/MaxMindBinaryTest.php +++ b/src/Provider/MaxMindBinary/Tests/MaxMindBinaryTest.php @@ -68,12 +68,12 @@ public function testLocationResultContainsExpectedFieldsForAnAmericanIp(): void $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('24.24.24.24')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(43.089200000000005, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-76.025000000000006, $result->getCoordinates()->getLongitude(), 0.001); @@ -96,12 +96,12 @@ public function testLocationResultContainsExpectedFieldsForASpanishIp(): void $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('80.24.24.24')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(41.543299999999988, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(2.1093999999999937, $result->getCoordinates()->getLongitude(), 0.001); @@ -127,12 +127,12 @@ public function testFindLocationByIp(string $ip, ?string $expectedCity, ?string $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create($ip)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals($expectedCity, $result->getLocality()); $this->assertEquals($expectedCountry, $result->getCountry()->getName()); } @@ -144,7 +144,7 @@ public function testShouldReturnResultsAsUtf8Encoded(): void /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertSame('Châlette-sur-loing', $result->getLocality()); } diff --git a/src/Provider/Nominatim/Tests/NominatimTest.php b/src/Provider/Nominatim/Tests/NominatimTest.php index ee7e9eeb8..8a4db71fa 100644 --- a/src/Provider/Nominatim/Tests/NominatimTest.php +++ b/src/Provider/Nominatim/Tests/NominatimTest.php @@ -69,12 +69,12 @@ public function testGetNodeStreetName(): void $provider = Nominatim::withOpenStreetMapServer($this->getHttpClient(), 'Geocoder PHP/Nominatim Provider/Nominatim Test'); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.86, 2.35)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('Rue Quincampoix', $result->getStreetName()); } @@ -83,12 +83,12 @@ public function testGeocodeWithRealAddress(): void $provider = Nominatim::withOpenStreetMapServer($this->getHttpClient(), 'Geocoder PHP/Nominatim Provider/Nominatim Test'); $results = $provider->geocodeQuery(GeocodeQuery::create('1 Place des Palais 1000 bruxelles')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Provider\Nominatim\Model\NominatimAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(50.8419916, $result->getCoordinates()->getLatitude(), 0.00001); $this->assertEqualsWithDelta(4.361988, $result->getCoordinates()->getLongitude(), 0.00001); $this->assertEquals('1', $result->getStreetNumber()); @@ -154,7 +154,7 @@ public function testGeocodeWithCountrycodes(): void $results = $provider->geocodeQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertGreaterThanOrEqual(1, $results->count()); /** @var \Geocoder\Model\Address $result */ @@ -173,12 +173,12 @@ public function testGeocodeWithViewbox(): void $results = $provider->geocodeQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Provider\Nominatim\Model\NominatimAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(50.8419916, $result->getCoordinates()->getLatitude(), 0.00001); $this->assertEqualsWithDelta(4.361988, $result->getCoordinates()->getLongitude(), 0.00001); $this->assertEquals('1', $result->getStreetNumber()); @@ -201,12 +201,12 @@ public function testGeocodeNoOSMId(): void $provider = Nominatim::withOpenStreetMapServer($this->getHttpClient(), 'Geocoder PHP/Nominatim Provider/Nominatim Test'); $results = $provider->geocodeQuery(GeocodeQuery::create('90210,United States')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Provider\Nominatim\Model\NominatimAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('90210', $result->getPostalCode()); $this->assertEquals('US', $result->getCountry()->getCode()); @@ -225,12 +225,12 @@ public function testGeocodeNoCountry(): void ->withData('bounded', true); $results = $provider->geocodeQuery($query); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Provider\Nominatim\Model\NominatimAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', $result->getAttribution()); $this->assertEquals('Italia', $result->getDisplayName()); @@ -245,12 +245,12 @@ public function testGeocodeNeighbourhood(): void $provider = Nominatim::withOpenStreetMapServer($this->getHttpClient(), 'Geocoder PHP/Nominatim Provider/Nominatim Test'); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(35.685939, 139.811695)->withLocale('en')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Provider\Nominatim\Model\NominatimAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', $result->getAttribution()); $this->assertEquals('Sarue 1-chome', $result->getNeighbourhood()); diff --git a/src/Provider/OpenRouteService/Tests/OpenRouteServiceTest.php b/src/Provider/OpenRouteService/Tests/OpenRouteServiceTest.php index 938794b7e..95f5cd6c4 100644 --- a/src/Provider/OpenRouteService/Tests/OpenRouteServiceTest.php +++ b/src/Provider/OpenRouteService/Tests/OpenRouteServiceTest.php @@ -49,12 +49,12 @@ public function testGeocodeWithRealAddress(): void $provider = new OpenRouteService($this->getHttpClient($_SERVER['OPEN_ROUTE_SERVICE_API_KEY']), $_SERVER['OPEN_ROUTE_SERVICE_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('242 Acklam Road, London, United Kingdom')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.521124, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-0.20360200000000001, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Acklam Road', $result->getStreetName()); @@ -74,12 +74,12 @@ public function testReverseWithRealCoordinates(): void $provider = new OpenRouteService($this->getHttpClient($_SERVER['OPEN_ROUTE_SERVICE_API_KEY']), $_SERVER['OPEN_ROUTE_SERVICE_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(54.0484068, -2.7990345)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(54.048411999999999, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-2.7989549999999999, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals(1, $result->getStreetNumber()); @@ -102,12 +102,12 @@ public function testReverseWithVillage(): void $provider = new OpenRouteService($this->getHttpClient($_SERVER['OPEN_ROUTE_SERVICE_API_KEY']), $_SERVER['OPEN_ROUTE_SERVICE_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(49.1390924, 1.6572462)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('Bray-et-Lû', $result->getLocality()); } @@ -120,12 +120,12 @@ public function testGeocodeWithCity(): void $provider = new OpenRouteService($this->getHttpClient($_SERVER['OPEN_ROUTE_SERVICE_API_KEY']), $_SERVER['OPEN_ROUTE_SERVICE_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Hanover')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.379952, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(9.787455, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -136,7 +136,7 @@ public function testGeocodeWithCity(): void /** @var \Geocoder\Model\Address $result */ $result = $results->get(1); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(52.37362, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(9.73711, $result->getCoordinates()->getLongitude(), 0.01); $this->assertCount(3, $result->getAdminLevels()); @@ -145,7 +145,7 @@ public function testGeocodeWithCity(): void /** @var \Geocoder\Model\Address $result */ $result = $results->get(2); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(18.393428, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-78.107687, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNull($result->getLocality()); @@ -155,7 +155,7 @@ public function testGeocodeWithCity(): void /** @var \Geocoder\Model\Address $result */ $result = $results->get(3); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(39.192889999999998, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-76.724140000000006, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('Hanover', $result->getLocality()); @@ -173,12 +173,12 @@ public function testGeocodeWithCityDistrict(): void $provider = new OpenRouteService($this->getHttpClient($_SERVER['OPEN_ROUTE_SERVICE_API_KEY']), $_SERVER['OPEN_ROUTE_SERVICE_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Kalbacher Hauptstraße 10, 60437 Frankfurt, Germany')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(2, $results); /** @var \Geocoder\Model\Address $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(50.189017, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(8.6367809999999992, $result->getCoordinates()->getLongitude(), 0.01); $this->assertEquals('10a', $result->getStreetNumber()); diff --git a/src/Provider/Photon/Tests/PhotonTest.php b/src/Provider/Photon/Tests/PhotonTest.php index 051a8cb41..67584e664 100644 --- a/src/Provider/Photon/Tests/PhotonTest.php +++ b/src/Provider/Photon/Tests/PhotonTest.php @@ -58,12 +58,12 @@ public function testGeocodeQuery(): void $provider = Photon::withKomootServer($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var PhotonAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.8631927, $result->getCoordinates()->getLatitude(), 0.00001); $this->assertEqualsWithDelta(2.3890894, $result->getCoordinates()->getLongitude(), 0.00001); $this->assertEquals('10', $result->getStreetNumber()); @@ -87,7 +87,7 @@ public function testGeocodeQueryWithNamedResult(): void $provider = Photon::withKomootServer($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('Sherlock Holmes Museum, 221B Baker St, London, England')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var PhotonAddress $result */ @@ -161,12 +161,12 @@ public function testReverseQuery(): void $reverseQuery = ReverseQuery::fromCoordinates(52, 10)->withLimit(1); $results = $provider->reverseQuery($reverseQuery); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var PhotonAddress $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(51.9982968, $result->getCoordinates()->getLatitude(), 0.00001); $this->assertEqualsWithDelta(9.998645, $result->getCoordinates()->getLongitude(), 0.00001); $this->assertEquals('31195', $result->getPostalCode()); diff --git a/src/Provider/PickPoint/Tests/PickPointTest.php b/src/Provider/PickPoint/Tests/PickPointTest.php index 5d240878a..4880ae0c1 100644 --- a/src/Provider/PickPoint/Tests/PickPointTest.php +++ b/src/Provider/PickPoint/Tests/PickPointTest.php @@ -66,12 +66,12 @@ public function testGetNodeStreetName(): void $provider = new PickPoint($this->getHttpClient($_SERVER['PICKPOINT_API_KEY']), $_SERVER['PICKPOINT_API_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.86, 2.35)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEquals('Rue Quincampoix', $result->getStreetName()); } } diff --git a/src/Provider/TomTom/Tests/TomTomTest.php b/src/Provider/TomTom/Tests/TomTomTest.php index 252cd35d9..d4d74d4c4 100644 --- a/src/Provider/TomTom/Tests/TomTomTest.php +++ b/src/Provider/TomTom/Tests/TomTomTest.php @@ -45,12 +45,12 @@ public function testGeocodeWithRealAddress(): void $provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Tagensvej 47, 2200 København N')->withLocale('en-GB')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(55.70, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(12.5529, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getBounds()); @@ -69,12 +69,12 @@ public function testGeocodeWithRealAddressWithFrenchLocale(): void $provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Tagensvej 47, 2200 København N')->withLocale('fr-FR')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); } public function testGeocodeWithLocalhostIPv4(): void @@ -159,12 +159,12 @@ public function testReverseWithRealCoordinates(): void $provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.86321648955345, 2.3887719959020615)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(48.86323, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(2.38877, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getBounds()); @@ -187,12 +187,12 @@ public function testGeocodeWithRealCoordinates(): void $provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(56.5231, 10.0659)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(56.52435, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(10.06744, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getBounds()); diff --git a/src/Provider/Yandex/Tests/YandexTest.php b/src/Provider/Yandex/Tests/YandexTest.php index 9b98ce4e3..a9453937c 100644 --- a/src/Provider/Yandex/Tests/YandexTest.php +++ b/src/Provider/Yandex/Tests/YandexTest.php @@ -76,12 +76,12 @@ public function testGeocodeWithRealAddress(): void $provider = new Yandex($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863277, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.389016, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -111,12 +111,12 @@ public function testGeocodeWithRealAddressWithUALocale(): void $provider = new Yandex($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('Copenhagen, Denmark')->withLocale('uk-UA')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(3, $results); /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(55.675676, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(12.585828, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -143,13 +143,13 @@ public function testGeocodeWithRealAddressWithUALocale(): void /** @var YandexAddress $result */ $result = $results->get(1); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(55.716853, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(12.463837, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(2); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(55.590338, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(12.130041, $result->getCoordinates()->getLongitude(), 0.01); } @@ -159,12 +159,12 @@ public function testGeocodeWithRealAddressWithUSLocale(): void $provider = new Yandex($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('1600 Pennsylvania Ave, Washington')->withLocale('en-US')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(38.897695, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-77.038692, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -194,12 +194,12 @@ public function testGeocodeWithRealAddressWithBYLocale(): void $provider = new Yandex($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('ул.Ленина, 19, Минск 220030, Республика Беларусь')->withLocale('be-BY')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(53.898077, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(27.563673, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -228,12 +228,12 @@ public function testReverseWithRealCoordinates(): void $provider = new Yandex($this->getHttpClient()); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.863216489553, 2.388771995902061)); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863212, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.388773, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -260,13 +260,13 @@ public function testReverseWithRealCoordinates(): void /** @var YandexAddress $result */ $result = $results->get(1); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.864848, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.3993549, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(2); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.856929, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.392115, $result->getCoordinates()->getLongitude(), 0.01); } @@ -276,12 +276,12 @@ public function testReverseWithRealCoordinatesWithUSLocaleAndStreeToponym(): voi $provider = new Yandex($this->getHttpClient(), 'street'); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.863216489553, 2.388771995902061)->withLocale('en-US')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.87132, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.404017, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -308,25 +308,25 @@ public function testReverseWithRealCoordinatesWithUSLocaleAndStreeToponym(): voi /** @var YandexAddress $result */ $result = $results->get(1); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863230, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.388261, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(2); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.866022, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.389662, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(3); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863918, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.387767, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(4); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863787, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.389600, $result->getCoordinates()->getLongitude(), 0.01); } @@ -336,12 +336,12 @@ public function testReverseWithRealCoordinatesWithUALocaleAndHouseToponym(): voi $provider = new Yandex($this->getHttpClient(), 'house'); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(60.4539471768582, 22.2567842183875)->withLocale('uk-UA')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(60.454462, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(22.256561, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -371,12 +371,12 @@ public function testReverseWithRealCoordinatesWithTRLocaleAndLocalityToponym(): $provider = new Yandex($this->getHttpClient(), 'locality'); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(40.900640, 29.198184)->withLocale('tr-TR')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(5, $results); /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEqualsWithDelta(41.01117, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(28.978151, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -409,7 +409,7 @@ public function testReverseMetroStationToGetName(): void /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result); + $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); $this->assertEquals('other', $result->getPrecision()); $this->assertEquals('метро Озерки', $result->getName()); $this->assertEquals('metro', $result->getKind()); From 767ec4462df1cbe9eac639202956268ba6c280f4 Mon Sep 17 00:00:00 2001 From: fbuchlak <30214087+fbuchlak@users.noreply.github.com> Date: Sun, 23 Mar 2025 09:57:03 +0100 Subject: [PATCH 2/2] style: fix php-cs-fixer --- src/Provider/Chain/Tests/ChainTest.php | 8 ++--- .../Geonames/Tests/CountryInfoTest.php | 2 +- src/Provider/Photon/Tests/PhotonTest.php | 6 ++-- src/Provider/Yandex/Tests/YandexTest.php | 34 +++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Provider/Chain/Tests/ChainTest.php b/src/Provider/Chain/Tests/ChainTest.php index 6a4d2454a..eaf5f4773 100644 --- a/src/Provider/Chain/Tests/ChainTest.php +++ b/src/Provider/Chain/Tests/ChainTest.php @@ -27,7 +27,7 @@ class ChainTest extends TestCase { public function testAdd(): void { - $mock = $this->getMockBuilder(\Geocoder\Provider\Provider::class)->getMock(); + $mock = $this->getMockBuilder(Provider::class)->getMock(); $chain = new Chain(); $chain->add($mock); @@ -49,7 +49,7 @@ public function testReverse(): void throw new \Exception(); })); - $mockTwo = $this->getMockBuilder(\Geocoder\Provider\Provider::class)->getMock(); + $mockTwo = $this->getMockBuilder(Provider::class)->getMock(); $result = new AddressCollection(['foo' => 'bar']); $mockTwo->expects($this->once()) ->method('reverseQuery') @@ -63,14 +63,14 @@ public function testReverse(): void public function testGeocode(): void { $query = GeocodeQuery::create('Paris'); - $mockOne = $this->getMockBuilder(\Geocoder\Provider\Provider::class)->getMock(); + $mockOne = $this->getMockBuilder(Provider::class)->getMock(); $mockOne->expects($this->once()) ->method('geocodeQuery') ->will($this->returnCallback(function () { throw new \Exception(); })); - $mockTwo = $this->getMockBuilder(\Geocoder\Provider\Provider::class)->getMock(); + $mockTwo = $this->getMockBuilder(Provider::class)->getMock(); $result = new AddressCollection(['foo' => 'bar']); $mockTwo->expects($this->once()) ->method('geocodeQuery') diff --git a/src/Provider/Geonames/Tests/CountryInfoTest.php b/src/Provider/Geonames/Tests/CountryInfoTest.php index a613df528..b67061747 100644 --- a/src/Provider/Geonames/Tests/CountryInfoTest.php +++ b/src/Provider/Geonames/Tests/CountryInfoTest.php @@ -38,7 +38,7 @@ public function testCountryInfoWithOneCountry(): void /* @var CountryInfo $result */ $result = current($results); - $this->assertInstanceOf(\Geocoder\Provider\Geonames\Model\CountryInfo::class, $result); + $this->assertInstanceOf(CountryInfo::class, $result); $this->assertInstanceOf(\Geocoder\Model\Bounds::class, $result->getBounds()); $this->assertEquals('AS', $result->getContinent()); $this->assertEquals('New Delhi', $result->getCapital()); diff --git a/src/Provider/Photon/Tests/PhotonTest.php b/src/Provider/Photon/Tests/PhotonTest.php index 67584e664..58466bcba 100644 --- a/src/Provider/Photon/Tests/PhotonTest.php +++ b/src/Provider/Photon/Tests/PhotonTest.php @@ -58,7 +58,7 @@ public function testGeocodeQuery(): void $provider = Photon::withKomootServer($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')); - $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); + $this->assertInstanceOf(AddressCollection::class, $results); $this->assertCount(1, $results); /** @var PhotonAddress $result */ @@ -87,7 +87,7 @@ public function testGeocodeQueryWithNamedResult(): void $provider = Photon::withKomootServer($this->getHttpClient()); $results = $provider->geocodeQuery(GeocodeQuery::create('Sherlock Holmes Museum, 221B Baker St, London, England')); - $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); + $this->assertInstanceOf(AddressCollection::class, $results); $this->assertCount(1, $results); /** @var PhotonAddress $result */ @@ -161,7 +161,7 @@ public function testReverseQuery(): void $reverseQuery = ReverseQuery::fromCoordinates(52, 10)->withLimit(1); $results = $provider->reverseQuery($reverseQuery); - $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); + $this->assertInstanceOf(AddressCollection::class, $results); $this->assertCount(1, $results); /** @var PhotonAddress $result */ diff --git a/src/Provider/Yandex/Tests/YandexTest.php b/src/Provider/Yandex/Tests/YandexTest.php index a9453937c..8c30784a2 100644 --- a/src/Provider/Yandex/Tests/YandexTest.php +++ b/src/Provider/Yandex/Tests/YandexTest.php @@ -81,7 +81,7 @@ public function testGeocodeWithRealAddress(): void /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863277, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.389016, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -116,7 +116,7 @@ public function testGeocodeWithRealAddressWithUALocale(): void /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(55.675676, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(12.585828, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -143,13 +143,13 @@ public function testGeocodeWithRealAddressWithUALocale(): void /** @var YandexAddress $result */ $result = $results->get(1); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(55.716853, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(12.463837, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(2); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(55.590338, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(12.130041, $result->getCoordinates()->getLongitude(), 0.01); } @@ -164,7 +164,7 @@ public function testGeocodeWithRealAddressWithUSLocale(): void /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(38.897695, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(-77.038692, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -199,7 +199,7 @@ public function testGeocodeWithRealAddressWithBYLocale(): void /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(53.898077, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(27.563673, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -233,7 +233,7 @@ public function testReverseWithRealCoordinates(): void /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863212, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.388773, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -260,13 +260,13 @@ public function testReverseWithRealCoordinates(): void /** @var YandexAddress $result */ $result = $results->get(1); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.864848, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.3993549, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(2); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.856929, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.392115, $result->getCoordinates()->getLongitude(), 0.01); } @@ -281,7 +281,7 @@ public function testReverseWithRealCoordinatesWithUSLocaleAndStreeToponym(): voi /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.87132, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.404017, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -308,25 +308,25 @@ public function testReverseWithRealCoordinatesWithUSLocaleAndStreeToponym(): voi /** @var YandexAddress $result */ $result = $results->get(1); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863230, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.388261, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(2); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.866022, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.389662, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(3); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863918, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.387767, $result->getCoordinates()->getLongitude(), 0.01); /** @var YandexAddress $result */ $result = $results->get(4); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(48.863787, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(2.389600, $result->getCoordinates()->getLongitude(), 0.01); } @@ -341,7 +341,7 @@ public function testReverseWithRealCoordinatesWithUALocaleAndHouseToponym(): voi /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(60.454462, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(22.256561, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -376,7 +376,7 @@ public function testReverseWithRealCoordinatesWithTRLocaleAndLocalityToponym(): /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEqualsWithDelta(41.01117, $result->getCoordinates()->getLatitude(), 0.01); $this->assertEqualsWithDelta(28.978151, $result->getCoordinates()->getLongitude(), 0.01); $this->assertNotNull($result->getBounds()); @@ -409,7 +409,7 @@ public function testReverseMetroStationToGetName(): void /** @var YandexAddress $result */ $result = $results->first(); - $this->assertInstanceOf(\Geocoder\Provider\Yandex\Model\YandexAddress::class, $result); + $this->assertInstanceOf(YandexAddress::class, $result); $this->assertEquals('other', $result->getPrecision()); $this->assertEquals('метро Озерки', $result->getName()); $this->assertEquals('metro', $result->getKind());