@@ -12,35 +12,27 @@ class MapQuestProviderTest extends TestCase
12
12
{
13
13
public function testGetName ()
14
14
{
15
- $ provider = new MapQuestProvider ($ this ->getMockAdapter ($ this ->never ()));
15
+ $ provider = new MapQuestProvider ($ this ->getMockAdapter ($ this ->never ()), ' api_key ' );
16
16
$ this ->assertEquals ('map_quest ' , $ provider ->getName ());
17
17
}
18
18
19
19
/**
20
20
* @expectedException Geocoder\Exception\NoResultException
21
- * @expectedExceptionMessage Could not find results for given query: http://open.mapquestapi.com/geocoding/v1/address?location=foobar&outFormat=json&maxResults=5&thumbMaps=fals
21
+ * @expectedExceptionMessage Could not find results for given query: http://open.mapquestapi.com/geocoding/v1/address?location=foobar&outFormat=json&maxResults=5&key=api_key& thumbMaps=false
22
22
*/
23
23
public function testGetGeocodedData ()
24
24
{
25
- if (!isset ($ _SERVER ['MAPQUEST_API_KEY ' ])) {
26
- $ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
27
- }
28
-
29
- $ provider = new MapQuestProvider ($ this ->getMockAdapter (), null , $ _SERVER ['MAPQUEST_API_KEY ' ]);
25
+ $ provider = new MapQuestProvider ($ this ->getMockAdapter (), 'api_key ' );
30
26
$ provider ->getGeocodedData ('foobar ' );
31
27
}
32
28
33
29
/**
34
30
* @expectedException \Geocoder\Exception\NoResultException
35
- * @expectedExceptionMessage Could not execute query http://open.mapquestapi.com/geocoding/v1/address?location=10+avenue+Gambetta%2C+Paris%2C+France&outFormat=json&maxResults=5&thumbMaps=false
31
+ * @expectedExceptionMessage Could not execute query: http://open.mapquestapi.com/geocoding/v1/address?location=10+avenue+Gambetta%2C+Paris%2C+France&outFormat=json&maxResults=5&key=api_key &thumbMaps=false
36
32
*/
37
33
public function testGetGeocodedDataWithAddressGetsNullContent ()
38
34
{
39
- if (!isset ($ _SERVER ['MAPQUEST_API_KEY ' ])) {
40
- $ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
41
- }
42
-
43
- $ provider = new MapQuestProvider ($ this ->getMockAdapterReturns (null ), null , $ _SERVER ['MAPQUEST_API_KEY ' ]);
35
+ $ provider = new MapQuestProvider ($ this ->getMockAdapterReturns (null ), 'api_key ' );
44
36
$ provider ->getGeocodedData ('10 avenue Gambetta, Paris, France ' );
45
37
}
46
38
@@ -50,7 +42,7 @@ public function testGetGeocodedDataWithRealAddress()
50
42
$ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
51
43
}
52
44
53
- $ provider = new MapQuestProvider ($ this ->getAdapter (), null , $ _SERVER ['MAPQUEST_API_KEY ' ]);
45
+ $ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
54
46
$ results = $ provider ->getGeocodedData ('10 avenue Gambetta, Paris, France ' );
55
47
56
48
$ this ->assertInternalType ('array ' , $ results );
@@ -75,15 +67,14 @@ public function testGetGeocodedDataWithRealAddress()
75
67
76
68
/**
77
69
* @expectedException \Geocoder\Exception\NoResultException
78
- * @expectedExceptionMessage Could not find results for given query: http://open.mapquestapi.com/geocoding/v1/reverse?lat=1.000000&lng=2.000000
79
70
*/
80
71
public function testGetReversedData ()
81
72
{
82
73
if (!isset ($ _SERVER ['MAPQUEST_API_KEY ' ])) {
83
74
$ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
84
75
}
85
76
86
- $ provider = new MapQuestProvider ($ this ->getMockAdapter (), null , $ _SERVER ['MAPQUEST_API_KEY ' ]);
77
+ $ provider = new MapQuestProvider ($ this ->getMockAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
87
78
$ provider ->getReversedData (array (1 , 2 ));
88
79
}
89
80
@@ -93,7 +84,7 @@ public function testGetReversedDataWithRealCoordinates()
93
84
$ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
94
85
}
95
86
96
- $ provider = new MapQuestProvider ($ this ->getAdapter (), null , $ _SERVER ['MAPQUEST_API_KEY ' ]);
87
+ $ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
97
88
$ result = $ provider ->getReversedData (array (54.0484068 , -2.7990345 ));
98
89
99
90
$ this ->assertInternalType ('array ' , $ result );
@@ -122,7 +113,7 @@ public function testGetGeocodedDataWithCity()
122
113
$ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
123
114
}
124
115
125
- $ provider = new MapQuestProvider ($ this ->getAdapter (), null , $ _SERVER ['MAPQUEST_API_KEY ' ]);
116
+ $ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
126
117
$ results = $ provider ->getGeocodedData ('Hanover ' );
127
118
128
119
$ this ->assertInternalType ('array ' , $ results );
@@ -166,7 +157,7 @@ public function testGetGeocodedDataWithCityDistrict()
166
157
$ this ->markTestSkipped ('You need to configure the CLOUDMADE_API_KEY value in phpunit.xml ' );
167
158
}
168
159
169
- $ provider = new MapQuestProvider ($ this ->getAdapter (), null , $ _SERVER ['MAPQUEST_API_KEY ' ]);
160
+ $ provider = new MapQuestProvider ($ this ->getAdapter (), $ _SERVER ['MAPQUEST_API_KEY ' ]);
170
161
$ result = $ provider ->getGeocodedData ('Kalbacher Hauptstraße 10, 60437 Frankfurt, Germany ' );
171
162
172
163
$ this ->assertInternalType ('array ' , $ result );
@@ -181,7 +172,7 @@ public function testGetGeocodedDataWithCityDistrict()
181
172
$ this ->assertEquals ('Kalbacher Hauptstraße 10 ' , $ result ['streetName ' ]);
182
173
$ this ->assertEquals (60437 , $ result ['zipcode ' ]);
183
174
$ this ->assertEquals ('Frankfurt ' , $ result ['city ' ]);
184
- $ this ->assertEquals ('Frankfurt am Main ' , $ result ['county ' ]);
175
+ $ this ->assertEquals ('Frankfurt ' , $ result ['county ' ]);
185
176
$ this ->assertEquals ('Hesse ' , $ result ['region ' ]);
186
177
$ this ->assertEquals ('DE ' , $ result ['country ' ]);
187
178
@@ -196,7 +187,7 @@ public function testGetGeocodedDataWithCityDistrict()
196
187
*/
197
188
public function testGetGeocodedDataWithLocalhostIPv4 ()
198
189
{
199
- $ provider = new MapQuestProvider ($ this ->getMockAdapter ($ this ->never ()), null , $ apiKey = ' my-api-key ' );
190
+ $ provider = new MapQuestProvider ($ this ->getMockAdapter ($ this ->never ()), ' api_key ' );
200
191
$ provider ->getGeocodedData ('127.0.0.1 ' );
201
192
}
202
193
@@ -206,7 +197,7 @@ public function testGetGeocodedDataWithLocalhostIPv4()
206
197
*/
207
198
public function testGetGeocodedDataWithLocalhostIPv6 ()
208
199
{
209
- $ provider = new MapQuestProvider ($ this ->getMockAdapter ($ this ->never ()), null , $ apiKey = ' my-api-key ' );
200
+ $ provider = new MapQuestProvider ($ this ->getMockAdapter ($ this ->never ()), ' api_key ' );
210
201
$ provider ->getGeocodedData ('::1 ' );
211
202
}
212
203
@@ -216,7 +207,7 @@ public function testGetGeocodedDataWithLocalhostIPv6()
216
207
*/
217
208
public function testGetGeocodedDataWithRealIPv4 ()
218
209
{
219
- $ provider = new MapQuestProvider ($ this ->getAdapter (), null , $ apiKey = ' my-api-key ' );
210
+ $ provider = new MapQuestProvider ($ this ->getAdapter (), ' api_key ' );
220
211
$ provider ->getGeocodedData ('74.200.247.59 ' );
221
212
}
222
213
@@ -226,7 +217,7 @@ public function testGetGeocodedDataWithRealIPv4()
226
217
*/
227
218
public function testGetGeocodedDataWithRealIPv6 ()
228
219
{
229
- $ provider = new MapQuestProvider ($ this ->getAdapter (), null , $ apiKey = ' my-api-key ' );
220
+ $ provider = new MapQuestProvider ($ this ->getAdapter (), ' api_key ' );
230
221
$ provider ->getGeocodedData ('::ffff:74.200.247.59 ' );
231
222
}
232
223
}
0 commit comments