You are here

public function GeolocationGoogleMapsGeocodingTest::testGeocoder in Geolocation Field 8.3

Test geocoding.

File

modules/geolocation_google_maps/tests/src/Functional/GeolocationGoogleMapsGeocodingTest.php, line 33

Class

GeolocationGoogleMapsGeocodingTest
Tests the creation of geolocation fields.

Namespace

Drupal\Tests\geolocation_google_maps\Functional

Code

public function testGeocoder() {

  /** @var \Drupal\geolocation\GeocoderInterface $geocoder */
  $geocoder = \Drupal::service('plugin.manager.geolocation.geocoder')
    ->getGeocoder('google_geocoding_api');
  $location = $geocoder
    ->geocode('H.Congreso de la Unión 66, El Parque, Venustiano Carranza, 15960 Ciudad de México, CDMX, Mexiko');
  $this
    ->assertArrayHasKey('location', $location);
}