Skip to content

style: convert string class names to constants #1252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Provider/AlgoliaPlaces/Tests/AlgoliaPlacesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);
}

Expand Down
24 changes: 12 additions & 12 deletions src/Provider/ArcGISOnline/Tests/ArcGISOnlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand Down
22 changes: 11 additions & 11 deletions src/Provider/BingMaps/Tests/BingMapsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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);
}

Expand All @@ -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());
Expand Down
8 changes: 4 additions & 4 deletions src/Provider/Chain/Tests/ChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ChainTest extends TestCase
{
public function testAdd(): void
{
$mock = $this->getMockBuilder('Geocoder\Provider\Provider')->getMock();
$mock = $this->getMockBuilder(Provider::class)->getMock();
$chain = new Chain();

$chain->add($mock);
Expand All @@ -49,7 +49,7 @@ public function testReverse(): void
throw new \Exception();
}));

$mockTwo = $this->getMockBuilder('Geocoder\\Provider\\Provider')->getMock();
$mockTwo = $this->getMockBuilder(Provider::class)->getMock();
$result = new AddressCollection(['foo' => 'bar']);
$mockTwo->expects($this->once())
->method('reverseQuery')
Expand All @@ -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(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(Provider::class)->getMock();
$result = new AddressCollection(['foo' => 'bar']);
$mockTwo->expects($this->once())
->method('geocodeQuery')
Expand Down
Loading