Skip to content

Commit 079a64d

Browse files
committed
Fix a bunch of tests
1 parent ce25339 commit 079a64d

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

src/Geocoder/Provider/BingMaps.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function geocode($address)
6464

6565
// This API doesn't handle IPs
6666
if (filter_var($address, FILTER_VALIDATE_IP)) {
67-
throw new UnsupportedOperation('The BingMaps provider does not support IP addresses, only street providers.');
67+
throw new UnsupportedOperation('The BingMaps provider does not support IP addresses, only street addresses.');
6868
}
6969

7070
$query = sprintf(self::GEOCODE_ENDPOINT_URL, $this->getLimit(), urlencode($address), $this->apiKey);
@@ -81,7 +81,7 @@ public function reverse($latitude, $longitude)
8181
throw new InvalidCredentials('No API key provided.');
8282
}
8383

84-
$query = sprintf(self::REVERSE_ENDPOINT_URL, $coordinates[0], $coordinates[1], $this->apiKey);
84+
$query = sprintf(self::REVERSE_ENDPOINT_URL, $latitude, $longitude, $this->apiKey);
8585

8686
return $this->executeQuery($query);
8787
}

src/Geocoder/Provider/Yandex.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,21 @@ function ($value, $key) use (&$details) {$details[$key] = $value;}
136136

137137
if (! empty($details['lowerCorner'])) {
138138
$coordinates = explode(' ', $details['lowerCorner']);
139-
$bounds['south'] = $longitude;
140-
$bounds['west'] = $latitude;
139+
$bounds['south'] = $coordinates[1];
140+
$bounds['west'] = $coordinates[0];
141141
}
142142

143143
if (! empty($details['upperCorner'])) {
144144
$coordinates = explode(' ', $details['upperCorner']);
145-
$bounds['north'] = $longitude;
146-
$bounds['east'] = $latitude;
145+
$bounds['north'] = $coordinates[1];
146+
$bounds['east'] = $coordinates[0];
147147
}
148148

149149
$coordinates = explode(' ', $details['pos']);
150150

151151
$results[] = array_merge($this->getDefaults(), array(
152-
'latitude' => $longitude,
153-
'longitude' => $latitude,
152+
'latitude' => $coordinates[1],
153+
'longitude' => $coordinates[0],
154154
'bounds' => $bounds,
155155
'streetNumber' => isset($details['PremiseNumber']) ? $details['PremiseNumber'] : null,
156156
'streetName' => isset($details['ThoroughfareName']) ? $details['ThoroughfareName'] : null,

tests/Geocoder/Tests/Provider/ArcGISOnlineTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testGetGeocodedDataWithEmpty()
4444

4545
/**
4646
* @expectedException \Geocoder\Exception\UnsupportedOperation
47-
* @expectedExceptionMessage The ArcGISOnline does not support IP addresses.
47+
* @expectedExceptionMessage The ArcGISOnline provider does not support IP addresses, only street addresses.
4848
*/
4949
public function testGetGeocodedDataWithLocalhostIPv4()
5050
{
@@ -54,7 +54,7 @@ public function testGetGeocodedDataWithLocalhostIPv4()
5454

5555
/**
5656
* @expectedException \Geocoder\Exception\UnsupportedOperation
57-
* @expectedExceptionMessage The ArcGISOnline does not support IP addresses.
57+
* @expectedExceptionMessage The ArcGISOnline provider does not support IP addresses, only street addresses.
5858
*/
5959
public function testGetGeocodedDataWithLocalhostIPv6()
6060
{
@@ -64,7 +64,7 @@ public function testGetGeocodedDataWithLocalhostIPv6()
6464

6565
/**
6666
* @expectedException \Geocoder\Exception\NoResult
67-
* @expectedExceptionMessage Could not execute query http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=10+avenue+Gambetta%2C+Paris%2C+France&maxLocations=5&f=json&outFields=*
67+
* @expectedExceptionMessage Could not execute query "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=10+avenue+Gambetta%2C+Paris%2C+France&maxLocations=5&f=json&outFields=*".
6868
*/
6969
public function testGetGeocodedDataWithAddressGetsNullContent()
7070
{
@@ -130,7 +130,7 @@ public function testGetGeocodedDataWithRealAddressAndHttps()
130130

131131
/**
132132
* @expectedException \Geocoder\Exception\NoResult
133-
* @expectedExceptionMessage No results found for query http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=10+avenue+Gambetta%2C+Paris%2C+France
133+
* @expectedExceptionMessage No results found for query "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=10+avenue+Gambetta%2C+Paris%2C+France".
134134
*/
135135
public function testGetGeocodedDataWithInvalidAddressForSourceCountry()
136136
{
@@ -140,7 +140,7 @@ public function testGetGeocodedDataWithInvalidAddressForSourceCountry()
140140

141141
/**
142142
* @expectedException \Geocoder\Exception\NoResult
143-
* @expectedExceptionMessage No results found for query https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=10+avenue+Gambetta%2C+Paris%2C+France
143+
* @expectedExceptionMessage No results found for query "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=10+avenue+Gambetta%2C+Paris%2C+France".
144144
*/
145145
public function testGetGeocodedDataWithInvalidAddressWithHttpsForSourceCountry()
146146
{
@@ -150,7 +150,7 @@ public function testGetGeocodedDataWithInvalidAddressWithHttpsForSourceCountry()
150150

151151
/**
152152
* @expectedException Geocoder\Exception\NoResult
153-
* @expectedExceptionMessage Could not execute query http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=2.000000,1.000000&maxLocations=5&f=json&outFields=*
153+
* @expectedExceptionMessage Could not execute query "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=2.000000,1.000000&maxLocations=5&f=json&outFields=*".
154154
*/
155155
public function testGetReversedDataWithInvalid()
156156
{
@@ -160,7 +160,7 @@ public function testGetReversedDataWithInvalid()
160160

161161
/**
162162
* @expectedException \Geocoder\Exception\NoResult
163-
* @expectedExceptionMessage Could not execute query http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=2.389020,48.863280&maxLocations=5&f=json&outFields=*
163+
* @expectedExceptionMessage Could not execute query "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=2.389020,48.863280&maxLocations=5&f=json&outFields=*".
164164
*/
165165
public function testGetReversedDataWithCoordinatesContentReturnNull()
166166
{
@@ -283,7 +283,7 @@ public function testGetGeocodedDataWithCity()
283283

284284
/**
285285
* @expectedException \Geocoder\Exception\UnsupportedOperation
286-
* @expectedExceptionMessage The ArcGISOnline does not support IP addresses.
286+
* @expectedExceptionMessage The ArcGISOnline provider does not support IP addresses, only street addresses.
287287
*/
288288
public function testGetGeocodedDataWithRealIPv4()
289289
{
@@ -293,7 +293,7 @@ public function testGetGeocodedDataWithRealIPv4()
293293

294294
/**
295295
* @expectedException \Geocoder\Exception\UnsupportedOperation
296-
* @expectedExceptionMessage The ArcGISOnline does not support IP addresses.
296+
* @expectedExceptionMessage The ArcGISOnline provider does not support IP addresses, only street addresses.
297297
*/
298298
public function testGetGeocodedDataWithRealIPv6()
299299
{

tests/Geocoder/Tests/Provider/BingMapsTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testGeocodeWithNullApiKey()
2424

2525
/**
2626
* @expectedException \Geocoder\Exception\NoResult
27-
* @expectedExceptionMessage Could not execute query http://dev.virtualearth.net/REST/v1/Locations/?maxResults=5&q=foobar&key=api_key
27+
* @expectedExceptionMessage Could not execute query "http://dev.virtualearth.net/REST/v1/Locations/?maxResults=5&q=foobar&key=api_key".
2828
*/
2929
public function testGeocodeWithInvalidData()
3030
{
@@ -34,7 +34,7 @@ public function testGeocodeWithInvalidData()
3434

3535
/**
3636
* @expectedException \Geocoder\Exception\NoResult
37-
* @expectedExceptionMessage Could not execute query http://dev.virtualearth.net/REST/v1/Locations/?maxResults=5&q=&key=api_key
37+
* @expectedExceptionMessage Could not execute query "http://dev.virtualearth.net/REST/v1/Locations/?maxResults=5&q=&key=api_key".
3838
*/
3939
public function testGeocodeWithNull()
4040
{
@@ -44,7 +44,7 @@ public function testGeocodeWithNull()
4444

4545
/**
4646
* @expectedException \Geocoder\Exception\NoResult
47-
* @expectedExceptionMessage Could not execute query http://dev.virtualearth.net/REST/v1/Locations/?maxResults=5&q=&key=api_key
47+
* @expectedExceptionMessage Could not execute query "http://dev.virtualearth.net/REST/v1/Locations/?maxResults=5&q=&key=api_key".
4848
*/
4949
public function testGeocodeWithEmpty()
5050
{
@@ -54,7 +54,7 @@ public function testGeocodeWithEmpty()
5454

5555
/**
5656
* @expectedException \Geocoder\Exception\UnsupportedOperation
57-
* @expectedExceptionMessage The BingMaps does not support IP addresses.
57+
* @expectedExceptionMessage The BingMaps provider does not support IP addresses, only street addresses.
5858
*/
5959
public function testGeocodeWithLocalhostIPv4()
6060
{
@@ -64,7 +64,7 @@ public function testGeocodeWithLocalhostIPv4()
6464

6565
/**
6666
* @expectedException \Geocoder\Exception\UnsupportedOperation
67-
* @expectedExceptionMessage The BingMaps does not support IP addresses.
67+
* @expectedExceptionMessage The BingMaps provider does not support IP addresses, only street addresses.
6868
*/
6969
public function testGeocodeWithLocalhostIPv6()
7070
{
@@ -74,7 +74,7 @@ public function testGeocodeWithLocalhostIPv6()
7474

7575
/**
7676
* @expectedException \Geocoder\Exception\NoResult
77-
* @expectedExceptionMessage Could not execute query http://dev.virtualearth.net/REST/v1/Locations/?maxResults=5&q=10+avenue+Gambetta%2C+Paris%2C+France&key=api_key
77+
* @expectedExceptionMessage Could not execute query "http://dev.virtualearth.net/REST/v1/Locations/?maxResults=5&q=10+avenue+Gambetta%2C+Paris%2C+France&key=api_key".
7878
*/
7979
public function testGeocodeWithAddressGetsNullContent()
8080
{
@@ -267,7 +267,7 @@ public function testGeocodeWithRealAddressReturnsMultipleResults()
267267

268268
/**
269269
* @expectedException Geocoder\Exception\NoResult
270-
* @expectedExceptionMessage Could not execute query http://dev.virtualearth.net/REST/v1/Locations/1.000000,2.000000?key=api_key
270+
* @expectedExceptionMessage Could not execute query "http://dev.virtualearth.net/REST/v1/Locations/1.000000,2.000000?key=api_key".
271271
*/
272272
public function testReverse()
273273
{
@@ -277,7 +277,7 @@ public function testReverse()
277277

278278
/**
279279
* @expectedException \Geocoder\Exception\NoResult
280-
* @expectedExceptionMessage Could not execute query http://dev.virtualearth.net/REST/v1/Locations/48.863216,2.388772?key=api_key
280+
* @expectedExceptionMessage Could not execute query "http://dev.virtualearth.net/REST/v1/Locations/48.863216,2.388772?key=api_key".
281281
*/
282282
public function testReverseWithCoordinatesContentReturnNull()
283283
{
@@ -324,7 +324,7 @@ public function testReverseWithRealCoordinatesReturnsSingleResult()
324324

325325
/**
326326
* @expectedException \Geocoder\Exception\UnsupportedOperation
327-
* @expectedExceptionMessage The BingMaps does not support IP addresses.
327+
* @expectedExceptionMessage The BingMaps provider does not support IP addresses, only street addresses.
328328
*/
329329
public function testGeocodeWithRealIPv4()
330330
{
@@ -338,7 +338,7 @@ public function testGeocodeWithRealIPv4()
338338

339339
/**
340340
* @expectedException \Geocoder\Exception\UnsupportedOperation
341-
* @expectedExceptionMessage The BingMaps does not support IP addresses.
341+
* @expectedExceptionMessage The BingMaps provider does not support IP addresses, only street addresses.
342342
*/
343343
public function testGeocodeWithRealIPv6()
344344
{

0 commit comments

Comments
 (0)