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());
 }
 /**
  * {@inheritdoc}
  *
  * @throws \Ivory\GoogleMap\Exception\GeocodingException If the request is not valid.
  */
 public function getGeocodedData($request)
 {
     if (is_string($request)) {
         $geocoderRequest = new GeocoderRequest();
         $geocoderRequest->setAddress($request);
     } elseif ($request instanceof GeocoderRequest) {
         $geocoderRequest = $request;
     } else {
         throw GeocodingException::invalidGeocoderProviderRequestArguments();
     }
     if (!$geocoderRequest->isValid()) {
         throw GeocodingException::invalidGeocoderProviderRequest();
     }
     $url = $this->generateUrl($geocoderRequest);
     $response = $this->getAdapter()->getContent($url);
     if ($response === null) {
         throw GeocodingException::invalidServiceResult();
     }
     $normalizedResponse = $this->parse($response);
     return $this->buildGeocoderResponse($normalizedResponse);
 }
 public function testIsValidWithAddress()
 {
     $this->geocoderRequest->setAddress('address');
     $this->assertTrue($this->geocoderRequest->isValid());
 }