File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
src/Provider/AzureMaps/Tests Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -93,4 +93,26 @@ public function testReverseWithRealCoordinates(): void
9393 $ this ->assertEquals ('Israel ' , $ result ->getCountry ()->getName ());
9494 $ this ->assertEquals ('IL ' , $ result ->getCountry ()->getCode ());
9595 }
96+
97+ public function testGeocodeIncludesMunicipality (): void
98+ {
99+ if (!isset ($ _SERVER ['AZURE_MAPS_SUBSCRIPTION_KEY ' ])) {
100+ $ this ->markTestSkipped ('You need to configure the AZURE_MAPS_SUBSCRIPTION_KEY value in phpunit.xml ' );
101+ }
102+
103+ $ subscriptionKey = $ _SERVER ['AZURE_MAPS_SUBSCRIPTION_KEY ' ];
104+ $ provider = new AzureMaps ($ this ->getHttpClient ($ subscriptionKey ), $ subscriptionKey );
105+
106+ $ results = $ provider ->geocodeQuery (GeocodeQuery::create ('Via Giuseppe Garibaldi 62, IT, Italy ' ));
107+
108+ $ this ->assertInstanceOf (AddressCollection::class, $ results );
109+ $ this ->assertGreaterThan (0 , $ results ->count (), 'No results found ' );
110+
111+ $ result = $ results ->first ();
112+
113+ $ this ->assertInstanceOf (Address::class, $ result );
114+ $ this ->assertNotNull ($ result ->getLocality (), 'Municipality (city) is missing in the response ' );
115+ $ this ->assertEquals ('Rome ' , $ result ->getLocality ());
116+ }
117+
96118}
You can’t perform that action at this time.
0 commit comments