/**
  * {@inheritDoc}
  */
 protected function buildQuery($query)
 {
     $query = parent::buildQuery($query);
     $query = sprintf('%s&client=%s', $query, $this->clientId);
     if (null !== $this->privateKey) {
         $query = $this->signQuery($query);
     }
     return $query;
 }
Exemplo n.º 2
0
 public function testGetGeocodedDataWithCityDistrict()
 {
     $provider = new GoogleMapsProvider(new \Geocoder\HttpAdapter\CurlHttpAdapter());
     $result = $provider->getGeocodedData('Kalbacher Hauptstraße 10, 60437 Frankfurt, Germany');
     $this->assertEquals('Kalbach-Riedberg', $result['cityDistrict']);
 }
 /**
  * @expectedException \Geocoder\Exception\InvalidCredentialsException
  * @expectedExceptionMessage API key is invalid https://maps.googleapis.com/maps/api/geocode/json?address=Columbia%20University&key=fake_key
  */
 public function testGetGeocodedDataWithRealInvalidApiKey()
 {
     $provider = new GoogleMapsProvider($this->getAdapter(), null, null, true, $this->testAPIKey);
     $provider->getGeocodedData('Columbia University');
 }
 /**
  * @expectedException \Geocoder\Exception\InvalidCredentialsException
  * @expectedExceptionMessage API key is invalid http://maps.googleapis.com/maps/api/geocode/json?address=10%20avenue%20Gambetta%2C%20Paris%2C%20France&sensor=false
  */
 public function testGetGeocodedDataWithInavlidApiKey()
 {
     $provider = new GoogleMapsProvider($this->getMockAdapterReturns('{"error_message":"The provided API key is invalid.", "status":"REQUEST_DENIED"}'));
     $provider->getGeocodedData('10 avenue Gambetta, Paris, France');
 }
Exemplo n.º 5
0
 public function testGetGeocodedDataWithCityDistrict()
 {
     $provider = new GoogleMapsProvider($this->getAdapter());
     $results = $provider->getGeocodedData('Kalbacher Hauptstraße 10, 60437 Frankfurt, Germany');
     $this->assertInternalType('array', $results);
     $this->assertCount(1, $results);
     $result = $results[0];
     $this->assertInternalType('array', $result);
     $this->assertEquals('Kalbach-Riedberg', $result['cityDistrict']);
 }