@@ -39,7 +39,7 @@ public function testGetGeocodedDataWithAddressGetsNullContent()
39
39
public function testGetGeocodedDataWithRealAddress ()
40
40
{
41
41
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 ' );
43
43
}
44
44
45
45
$ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -71,7 +71,7 @@ public function testGetGeocodedDataWithRealAddress()
71
71
public function testGetReversedData ()
72
72
{
73
73
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 ' );
75
75
}
76
76
77
77
$ provider = new MapQuestProvider ($ this ->getMockAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -81,7 +81,7 @@ public function testGetReversedData()
81
81
public function testGetReversedDataWithRealCoordinates ()
82
82
{
83
83
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 ' );
85
85
}
86
86
87
87
$ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -110,7 +110,7 @@ public function testGetReversedDataWithRealCoordinates()
110
110
public function testGetGeocodedDataWithCity ()
111
111
{
112
112
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 ' );
114
114
}
115
115
116
116
$ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -154,7 +154,7 @@ public function testGetGeocodedDataWithCity()
154
154
public function testGetGeocodedDataWithCityDistrict ()
155
155
{
156
156
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 ' );
158
158
}
159
159
160
160
$ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
@@ -220,4 +220,42 @@ public function testGetGeocodedDataWithRealIPv6()
220
220
$ provider = new MapQuestProvider ($ this ->getAdapter (), 'api_key ' );
221
221
$ provider ->getGeocodedData ('::ffff:74.200.247.59 ' );
222
222
}
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
+ }
223
261
}
0 commit comments