public function testGeocodedDataWithGeocoderRequest()
 {
     $request = new GeocoderRequest();
     $request->setAddress('Paris');
     $request->setBound(48.815573, 2.224199, 48.9021449, 2.4699208);
     $request->setRegion('FR');
     $request->setLanguage('PL');
     $response = $this->geocoderProvider->getGeocodedData($request);
     $this->assertInstanceOf('Ivory\\GoogleMap\\Services\\Geocoding\\Result\\GeocoderResponse', $response);
     $this->assertNotEmpty($response->getResults());
     $this->assertSame(GeocoderStatus::OK, $response->getStatus());
 }
 /**
  * Generates geocoding URL according to the request.
  *
  * @param \Ivory\GoogleMap\Services\Geocoding\GeocoderRequest $geocoderRequest The geocoder request.
  *
  * @return string The generated URL.
  */
 protected function generateUrl(GeocoderRequest $geocoderRequest)
 {
     $httpQuery = array();
     if ($geocoderRequest->hasAddress()) {
         $httpQuery['address'] = $geocoderRequest->getAddress();
     } else {
         $httpQuery['latlng'] = sprintf('%s,%s', $geocoderRequest->getCoordinate()->getLatitude(), $geocoderRequest->getCoordinate()->getLongitude());
     }
     if ($geocoderRequest->hasBound()) {
         $httpQuery['bound'] = sprintf('%s,%s|%s,%s', $geocoderRequest->getBound()->getSouthWest()->getLatitude(), $geocoderRequest->getBound()->getSouthWest()->getLongitude(), $geocoderRequest->getBound()->getNorthEast()->getLatitude(), $geocoderRequest->getBound()->getNorthEast()->getLongitude());
     }
     if ($geocoderRequest->hasRegion()) {
         $httpQuery['region'] = $geocoderRequest->getRegion();
     }
     if ($geocoderRequest->hasLanguage()) {
         $httpQuery['language'] = $geocoderRequest->getLanguage();
     }
     $httpQuery['sensor'] = $geocoderRequest->hasSensor() ? 'true' : 'false';
     $url = sprintf('%s/%s?%s', $this->getUrl(), $this->getFormat(), http_build_query($httpQuery));
     return $this->signUrl($url);
 }
 public function testIsValidWithCoordinate()
 {
     $this->geocoderRequest->setCoordinate(1, 1);
     $this->assertTrue($this->geocoderRequest->isValid());
 }