@@ -39,7 +39,7 @@ public function testGetGeocodedDataWithAddressGetsNullContent()
3939 public function testGetGeocodedDataWithRealAddress ()
4040 {
4141 if (!isset ($ _SERVER ['MAPQUEST_API_KEY ' ])) {
42- $ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
42+ $ this ->markTestSkipped ('You need to configure the MAPQUEST_API_KEY value in phpunit.xml ' );
4343 }
4444
4545 $ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -71,7 +71,7 @@ public function testGetGeocodedDataWithRealAddress()
7171 public function testGetReversedData ()
7272 {
7373 if (!isset ($ _SERVER ['MAPQUEST_API_KEY ' ])) {
74- $ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
74+ $ this ->markTestSkipped ('You need to configure the MAPQUEST_API_KEY value in phpunit.xml ' );
7575 }
7676
7777 $ provider = new MapQuestProvider ($ this ->getMockAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -81,7 +81,7 @@ public function testGetReversedData()
8181 public function testGetReversedDataWithRealCoordinates ()
8282 {
8383 if (!isset ($ _SERVER ['MAPQUEST_API_KEY ' ])) {
84- $ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
84+ $ this ->markTestSkipped ('You need to configure the MAPQUEST_API_KEY value in phpunit.xml ' );
8585 }
8686
8787 $ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -110,7 +110,7 @@ public function testGetReversedDataWithRealCoordinates()
110110 public function testGetGeocodedDataWithCity ()
111111 {
112112 if (!isset ($ _SERVER ['MAPQUEST_API_KEY ' ])) {
113- $ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
113+ $ this ->markTestSkipped ('You need to configure the MAPQUEST_API_KEY value in phpunit.xml ' );
114114 }
115115
116116 $ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -154,7 +154,7 @@ public function testGetGeocodedDataWithCity()
154154 public function testGetGeocodedDataWithCityDistrict ()
155155 {
156156 if (!isset ($ _SERVER ['MAPQUEST_API_KEY ' ])) {
157- $ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
157+ $ this ->markTestSkipped ('You need to configure the MAPQUEST_API_KEY value in phpunit.xml ' );
158158 }
159159
160160 $ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -220,4 +220,42 @@ public function testGetGeocodedDataWithRealIPv6()
220220 $ provider = new MapQuestProvider ($ this ->getAdapter (), 'api_key ' );
221221 $ provider ->getGeocodedData ('::ffff:74.200.247.59 ' );
222222 }
223+
224+ public function testLicensedVsOpenGeocodeEndpoints ()
225+ {
226+ $ licensed = false ;
227+ $ provider = new MockMapQuestProvider ($ this ->getAdapter (), 'api_key ' , null , $ licensed );
228+ $ queryUrl = $ provider ->getGeocodedData ('Hanover ' );
229+ $ this ->assertContains ('http://open. ' , $ queryUrl );
230+
231+ $ licensed = true ;
232+ $ provider = new MockMapQuestProvider ($ this ->getAdapter (), 'api_key ' , null , $ licensed );
233+ $ queryUrl = $ provider ->getGeocodedData ('Hanover ' );
234+ $ this ->assertContains ('http://www. ' , $ queryUrl );
235+ }
236+
237+ public function testLicensedVsOpenReverseGeocodeEndpoints ()
238+ {
239+ $ licensed = false ;
240+ $ provider = new MockMapQuestProvider ($ this ->getAdapter (), 'api_key ' , null , $ licensed );
241+ $ queryUrl = $ provider ->getReversedData (array (54.0484068 , -2.7990345 ));
242+ $ this ->assertContains ('http://open. ' , $ queryUrl );
243+
244+ $ licensed = true ;
245+ $ provider = new MockMapQuestProvider ($ this ->getAdapter (), 'api_key ' , null , $ licensed );
246+ $ queryUrl = $ provider ->getReversedData (array (54.0484068 , -2.7990345 ));
247+ $ this ->assertContains ('http://www. ' , $ queryUrl );
248+ }
249+ }
250+
251+ class MockMapQuestProvider extends MapQuestProvider
252+ {
253+ /**
254+ * Short circuits so assertions can inspect the
255+ * executed query URL
256+ */
257+ protected function executeQuery ($ query )
258+ {
259+ return $ query ;
260+ }
223261}
0 commit comments