@@ -41,7 +41,7 @@ protected function getCacheDir()
41
41
42
42
public function testGetName ()
43
43
{
44
- $ provider = new GoogleMaps ($ this ->getMockedHttpClient ());
44
+ $ provider = new GoogleMaps ($ this ->getMockedHttpClient (), null , ' mock-api-key ' );
45
45
$ this ->assertEquals ('google_maps ' , $ provider ->getName ());
46
46
}
47
47
@@ -50,7 +50,7 @@ public function testGetName()
50
50
*/
51
51
public function testGeocodeWithLocalhostIPv4 ()
52
52
{
53
- $ provider = new GoogleMaps ($ this ->getMockedHttpClient ());
53
+ $ provider = new GoogleMaps ($ this ->getMockedHttpClient (), null , ' mock-api-key ' );
54
54
$ provider ->geocodeQuery (GeocodeQuery::create ('127.0.0.1 ' ));
55
55
}
56
56
@@ -60,7 +60,7 @@ public function testGeocodeWithLocalhostIPv4()
60
60
*/
61
61
public function testGeocodeWithLocalhostIPv6 ()
62
62
{
63
- $ provider = new GoogleMaps ($ this ->getMockedHttpClient ());
63
+ $ provider = new GoogleMaps ($ this ->getMockedHttpClient (), null , ' mock-api-key ' );
64
64
$ provider ->geocodeQuery (GeocodeQuery::create ('::1 ' ));
65
65
}
66
66
@@ -80,7 +80,7 @@ public function testGeocodeWithRealIp()
80
80
*/
81
81
public function testGeocodeWithQuotaExceeded ()
82
82
{
83
- $ provider = new GoogleMaps ($ this ->getMockedHttpClient ('{"status":"OVER_QUERY_LIMIT"} ' ));
83
+ $ provider = new GoogleMaps ($ this ->getMockedHttpClient ('{"status":"OVER_QUERY_LIMIT"} ' ), null , ' mock-api-key ' );
84
84
$ provider ->geocodeQuery (GeocodeQuery::create ('10 avenue Gambetta, Paris, France ' ));
85
85
}
86
86
@@ -148,7 +148,7 @@ public function testGeocodeBoundsWithRealAddressForNonRooftopLocation()
148
148
*/
149
149
public function testReverse ()
150
150
{
151
- $ provider = new GoogleMaps ($ this ->getMockedHttpClient ());
151
+ $ provider = new GoogleMaps ($ this ->getMockedHttpClient (), null , ' mock-api-key ' );
152
152
$ provider ->reverseQuery (ReverseQuery::fromCoordinates (1 , 2 ));
153
153
}
154
154
@@ -221,7 +221,7 @@ public function testGeocodeWithCityDistrict()
221
221
*/
222
222
public function testGeocodeWithInvalidApiKey ()
223
223
{
224
- $ provider = new GoogleMaps ($ this ->getMockedHttpClient ('{"error_message":"The provided API key is invalid.", "status":"REQUEST_DENIED"} ' ));
224
+ $ provider = new GoogleMaps ($ this ->getMockedHttpClient ('{"error_message":"The provided API key is invalid.", "status":"REQUEST_DENIED"} ' ), null , ' mock-api-key ' );
225
225
$ provider ->geocodeQuery (GeocodeQuery::create ('10 avenue Gambetta, Paris, France ' ));
226
226
}
227
227
@@ -274,7 +274,9 @@ public function testCorrectlySerializesComponents()
274
274
function (RequestInterface $ request ) use (&$ uri ) {
275
275
$ uri = (string ) $ request ->getUri ();
276
276
}
277
- )
277
+ ),
278
+ null ,
279
+ 'test-api-key '
278
280
);
279
281
280
282
$ query = GeocodeQuery::create ('address ' )->withData ('components ' , [
@@ -291,7 +293,7 @@ function (RequestInterface $request) use (&$uri) {
291
293
$ this ->assertEquals (
292
294
'https://maps.googleapis.com/maps/api/geocode/json ' .
293
295
'?address=address ' .
294
- '&components=country%3ASE%7Cpostal_code%3A22762%7Clocality%3ALund ' ,
296
+ '&components=country%3ASE%7Cpostal_code%3A22762%7Clocality%3ALund&key=test-api-key ' ,
295
297
$ uri
296
298
);
297
299
}
@@ -305,7 +307,9 @@ public function testCorrectlySetsComponents()
305
307
function (RequestInterface $ request ) use (&$ uri ) {
306
308
$ uri = (string ) $ request ->getUri ();
307
309
}
308
- )
310
+ ),
311
+ null ,
312
+ 'test-api-key '
309
313
);
310
314
311
315
$ query = GeocodeQuery::create ('address ' )
@@ -319,7 +323,7 @@ function (RequestInterface $request) use (&$uri) {
319
323
$ this ->assertEquals (
320
324
'https://maps.googleapis.com/maps/api/geocode/json ' .
321
325
'?address=address ' .
322
- '&components=country%3ASE%7Cpostal_code%3A22762%7Clocality%3ALund ' ,
326
+ '&components=country%3ASE%7Cpostal_code%3A22762%7Clocality%3ALund&key=test-api-key ' ,
323
327
$ uri
324
328
);
325
329
}
0 commit comments