public function GeolocationGoogleMapsGeocodingTest::testReverseGeocoder in Geolocation Field 8.3
Test reverse geocoding.
File
- modules/
geolocation_google_maps/ tests/ src/ Functional/ GeolocationGoogleMapsGeocodingTest.php, line 43
Class
- GeolocationGoogleMapsGeocodingTest
- Tests the creation of geolocation fields.
Namespace
Drupal\Tests\geolocation_google_maps\FunctionalCode
public function testReverseGeocoder() {
/** @var \Drupal\geolocation\GeocoderInterface $geocoder */
$geocoder = \Drupal::service('plugin.manager.geolocation.geocoder')
->getGeocoder('google_geocoding_api');
$latitude = 38.56;
$longitude = 68.773889;
$address = $geocoder
->reverseGeocode($latitude, $longitude);
$this
->assertArrayHasKey('atomics', $address);
}