@@ -85,7 +85,7 @@ public function testGeocodeWithAddressGetsNullContent()
85
85
public function testGeocodeReturnsMultipleResults ()
86
86
{
87
87
$ json = <<<JSON
88
- {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2013 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":3,"resources":[{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[48.859354042429317,2.3809438666389395,48.86707947757067,2.3966003933610596],"name":"10 Avenue Gambetta, 75020 Paris","point":{"type":"Point","coordinates":[48.863216759999993,2.3887721299999995]},"address":{"addressLine":"10 Avenue Gambetta","adminDistrict":"IdF","adminDistrict2":"Paris","countryRegion":"France","formattedAddress":"10 Avenue Gambetta, 75020 Paris","locality":"Paris","postalCode":"75020"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[48.863216759999993,2.3887721299999995],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Ambiguous","Good"]},{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[48.809565092429317,2.3172171827738461,48.81729052757067,2.3328581572261538],"name":"10 Avenue Léon Gambetta, 92120 Montrouge","point":{"type":"Point","coordinates":[48.813427809999993,2.32503767]},"address":{"addressLine":"10 Avenue Léon Gambetta","adminDistrict":"IdF","adminDistrict2":"Hauts-de-Seine","countryRegion":"France","formattedAddress":"10 Avenue Léon Gambetta, 92120 Montrouge","locality":"Montrouge","postalCode":"92120"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[48.813427809999993,2.32503767],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Ambiguous","Good"]},{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[48.806278752429328,2.4278605052896745,48.814004187570681,2.4435004547103261],"name":"10 Avenue Gambetta, 94700 Maisons-Alfort","point":{"type":"Point","coordinates":[48.810141470000005,2.4356804800000003]},"address":{"addressLine":"10 Avenue Gambetta","adminDistrict":"IdF","adminDistrict2":"Val-De-Marne","countryRegion":"France","formattedAddress":"10 Avenue Gambetta, 94700 Maisons-Alfort","locality":"Maisons-Alfort","postalCode":"94700"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[48.810141470000005,2.4356804800000003],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Ambiguous","Good"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"fd9b0b8fe1a34ad384923b5d0937bfb2|AMSM001404|02.00.139.700|AMSMSNVM002409, AMSMSNVM001862, AMSMSNVM001322, AMSMSNVM000044"}
88
+ {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2013 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":3,"resources":[{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[48.859354042429317,2.3809438666389395,48.86707947757067,2.3966003933610596],"name":"10 Avenue Gambetta, 75020 Paris","point":{"type":"Point","coordinates":[48.863216759999993,2.3887721299999995]},"address":{"addressLine":"10 Avenue Gambetta","adminDistrict":"IdF","adminDistrict2":"Paris","countryRegion":"France","countryRegionIso2":"FR","formattedAddress":"10 Avenue Gambetta, 75020 Paris","locality":"Paris","postalCode":"75020"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[48.863216759999993,2.3887721299999995],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Ambiguous","Good"]},{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[48.809565092429317,2.3172171827738461,48.81729052757067,2.3328581572261538],"name":"10 Avenue Léon Gambetta, 92120 Montrouge","point":{"type":"Point","coordinates":[48.813427809999993,2.32503767]},"address":{"addressLine":"10 Avenue Léon Gambetta","adminDistrict":"IdF","adminDistrict2":"Hauts-de-Seine","countryRegion":"France","countryRegionIso2":"FR","formattedAddress":"10 Avenue Léon Gambetta, 92120 Montrouge","locality":"Montrouge","postalCode":"92120"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[48.813427809999993,2.32503767],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Ambiguous","Good"]},{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[48.806278752429328,2.4278605052896745,48.814004187570681,2.4435004547103261],"name":"10 Avenue Gambetta, 94700 Maisons-Alfort","point":{"type":"Point","coordinates":[48.810141470000005,2.4356804800000003]},"address":{"addressLine":"10 Avenue Gambetta","adminDistrict":"IdF","adminDistrict2":"Val-De-Marne","countryRegion":"France","countryRegionIso2":"FR","formattedAddress":"10 Avenue Gambetta, 94700 Maisons-Alfort","locality":"Maisons-Alfort","postalCode":"94700"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[48.810141470000005,2.4356804800000003],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Ambiguous","Good"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"fd9b0b8fe1a34ad384923b5d0937bfb2|AMSM001404|02.00.139.700|AMSMSNVM002409, AMSMSNVM001862, AMSMSNVM001322, AMSMSNVM000044"}
89
89
JSON ;
90
90
91
91
$ provider = new BingMaps ($ this ->getMockAdapterReturns ($ json ), 'api_key ' , 'fr_FR ' );
@@ -112,8 +112,8 @@ public function testGeocodeReturnsMultipleResults()
112
112
$ this ->assertEquals ('Paris ' , $ result ->getAdminLevels ()->get (2 )->getName ());
113
113
$ this ->assertEquals ('IdF ' , $ result ->getAdminLevels ()->get (1 )->getName ());
114
114
$ this ->assertEquals ('France ' , $ result ->getCountry ()->getName ());
115
+ $ this ->assertEquals ('FR ' , $ result ->getCountry ()->getCode ());
115
116
116
- $ this ->assertNull ($ result ->getCountry ()->getCode ());
117
117
$ this ->assertNull ($ result ->getTimezone ());
118
118
119
119
/** @var \Geocoder\Model\Address $result */
@@ -134,6 +134,7 @@ public function testGeocodeReturnsMultipleResults()
134
134
$ this ->assertEquals ('Hauts-de-Seine ' , $ result ->getAdminLevels ()->get (2 )->getName ());
135
135
$ this ->assertEquals ('IdF ' , $ result ->getAdminLevels ()->get (1 )->getName ());
136
136
$ this ->assertEquals ('France ' , $ result ->getCountry ()->getName ());
137
+ $ this ->assertEquals ('FR ' , $ result ->getCountry ()->getCode ());
137
138
138
139
/** @var \Geocoder\Model\Address $result */
139
140
$ result = $ results ->get (2 );
@@ -153,12 +154,13 @@ public function testGeocodeReturnsMultipleResults()
153
154
$ this ->assertEquals ('Val-De-Marne ' , $ result ->getAdminLevels ()->get (2 )->getName ());
154
155
$ this ->assertEquals ('IdF ' , $ result ->getAdminLevels ()->get (1 )->getName ());
155
156
$ this ->assertEquals ('France ' , $ result ->getCountry ()->getName ());
157
+ $ this ->assertEquals ('FR ' , $ result ->getCountry ()->getCode ());
156
158
}
157
159
158
160
public function testReverseReturnsSingleResult ()
159
161
{
160
162
$ json = <<<JSON
161
- {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2013 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[48.859353771982775,2.3809437325832983,48.867079207124128,2.3966002592208246],"name":"10 Avenue Gambetta, 75020 20e Arrondissement","point":{"type":"Point","coordinates":[48.863216489553452,2.3887719959020615]},"address":{"addressLine":"10 Avenue Gambetta","adminDistrict":"IdF","adminDistrict2":"Paris","countryRegion":"France","formattedAddress":"10 Avenue Gambetta, 75020 20e Arrondissement","locality":"20e Arrondissement","postalCode":"75020"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[48.863216489553452,2.3887719959020615],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Good"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"0691dabd257043b381b678fbfaf799dd|AMSM001401|02.00.139.700|AMSMSNVM001951, AMSMSNVM002152"}
163
+ {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2013 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[48.859353771982775,2.3809437325832983,48.867079207124128,2.3966002592208246],"name":"10 Avenue Gambetta, 75020 20e Arrondissement","point":{"type":"Point","coordinates":[48.863216489553452,2.3887719959020615]},"address":{"addressLine":"10 Avenue Gambetta","adminDistrict":"IdF","adminDistrict2":"Paris","countryRegion":"France","countryRegionIso2":"FR","formattedAddress":"10 Avenue Gambetta, 75020 20e Arrondissement","locality":"20e Arrondissement","postalCode":"75020"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[48.863216489553452,2.3887719959020615],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Good"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"0691dabd257043b381b678fbfaf799dd|AMSM001401|02.00.139.700|AMSMSNVM001951, AMSMSNVM002152"}
162
164
JSON ;
163
165
164
166
$ provider = new BingMaps ($ this ->getMockAdapterReturns ($ json ), 'api_key ' );
@@ -185,8 +187,8 @@ public function testReverseReturnsSingleResult()
185
187
$ this ->assertEquals ('Paris ' , $ result ->getAdminLevels ()->get (2 )->getName ());
186
188
$ this ->assertEquals ('IdF ' , $ result ->getAdminLevels ()->get (1 )->getName ());
187
189
$ this ->assertEquals ('France ' , $ result ->getCountry ()->getName ());
190
+ $ this ->assertEquals ('FR ' , $ result ->getCountry ()->getCode ());
188
191
189
- $ this ->assertNull ($ result ->getCountry ()->getCode ());
190
192
$ this ->assertNull ($ result ->getTimezone ());
191
193
}
192
194
@@ -220,10 +222,10 @@ public function testGeocodeWithRealAddressReturnsSingleResults()
220
222
$ this ->assertEquals ('Paris ' , $ result ->getAdminLevels ()->get (2 )->getName ());
221
223
$ this ->assertEquals ('IdF ' , $ result ->getAdminLevels ()->get (1 )->getName ());
222
224
$ this ->assertEquals ('France ' , $ result ->getCountry ()->getName ());
225
+ $ this ->assertEquals ('FR ' , $ result ->getCountry ()->getCode ());
223
226
224
227
$ this ->assertNull ($ result ->getAdminLevels ()->get (2 )->getCode ());
225
228
$ this ->assertNull ($ result ->getAdminLevels ()->get (1 )->getCode ());
226
- $ this ->assertNull ($ result ->getCountry ()->getCode ());
227
229
$ this ->assertNull ($ result ->getTimezone ());
228
230
229
231
}
@@ -258,6 +260,7 @@ public function testGeocodeWithRealAddressReturnsMultipleResults()
258
260
$ this ->assertEquals ('AT ' , $ result ->getAdminLevels ()->get (2 )->getName ());
259
261
$ this ->assertEquals ('Piem. ' , $ result ->getAdminLevels ()->get (1 )->getName ());
260
262
$ this ->assertEquals ('Italie ' , $ result ->getCountry ()->getName ());
263
+ $ this ->assertEquals ('IT ' , $ result ->getCountry ()->getCode ());
261
264
262
265
/** @var \Geocoder\Model\Address $result */
263
266
$ result = $ results ->get (1 );
@@ -277,6 +280,7 @@ public function testGeocodeWithRealAddressReturnsMultipleResults()
277
280
$ this ->assertEquals ('TN ' , $ result ->getAdminLevels ()->get (2 )->getName ());
278
281
$ this ->assertEquals ('Tr.A.A. ' , $ result ->getAdminLevels ()->get (1 )->getName ());
279
282
$ this ->assertEquals ('Italie ' , $ result ->getCountry ()->getName ());
283
+ $ this ->assertEquals ('IT ' , $ result ->getCountry ()->getCode ());
280
284
281
285
/** @var \Geocoder\Model\Address $result */
282
286
$ result = $ results ->get (2 );
@@ -296,6 +300,7 @@ public function testGeocodeWithRealAddressReturnsMultipleResults()
296
300
$ this ->assertEquals ('PC ' , $ result ->getAdminLevels ()->get (2 )->getName ());
297
301
$ this ->assertEquals ('Em.Rom. ' , $ result ->getAdminLevels ()->get (1 )->getName ());
298
302
$ this ->assertEquals ('Italie ' , $ result ->getCountry ()->getName ());
303
+ $ this ->assertEquals ('IT ' , $ result ->getCountry ()->getCode ());
299
304
300
305
/** @var \Geocoder\Model\Address $result */
301
306
$ result = $ results ->get (3 );
@@ -315,6 +320,7 @@ public function testGeocodeWithRealAddressReturnsMultipleResults()
315
320
$ this ->assertEquals ('PO ' , $ result ->getAdminLevels ()->get (2 )->getName ());
316
321
$ this ->assertEquals ('Tosc. ' , $ result ->getAdminLevels ()->get (1 )->getName ());
317
322
$ this ->assertEquals ('Italie ' , $ result ->getCountry ()->getName ());
323
+ $ this ->assertEquals ('IT ' , $ result ->getCountry ()->getCode ());
318
324
319
325
/** @var \Geocoder\Model\Address $result */
320
326
$ result = $ results ->get (4 );
@@ -334,6 +340,7 @@ public function testGeocodeWithRealAddressReturnsMultipleResults()
334
340
$ this ->assertEquals ('AQ ' , $ result ->getAdminLevels ()->get (2 )->getName ());
335
341
$ this ->assertEquals ('Abr. ' , $ result ->getAdminLevels ()->get (1 )->getName ());
336
342
$ this ->assertEquals ('Italie ' , $ result ->getCountry ()->getName ());
343
+ $ this ->assertEquals ('IT ' , $ result ->getCountry ()->getCode ());
337
344
}
338
345
339
346
/**
@@ -386,8 +393,8 @@ public function testReverseWithRealCoordinatesReturnsSingleResult()
386
393
$ this ->assertEquals ('Paris ' , $ result ->getAdminLevels ()->get (2 )->getName ());
387
394
$ this ->assertEquals ('IdF ' , $ result ->getAdminLevels ()->get (1 )->getName ());
388
395
$ this ->assertEquals ('France ' , $ result ->getCountry ()->getName ());
396
+ $ this ->assertEquals ('FR ' , $ result ->getCountry ()->getCode ());
389
397
390
- $ this ->assertNull ($ result ->getCountry ()->getCode ());
391
398
$ this ->assertNull ($ result ->getTimezone ());
392
399
}
393
400
0 commit comments