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 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');
 }
 /**
  * @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');
 }
 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']);
 }