You are here

public function GeolocationSchemaCoverageTest::testMapProvidersDefaults in Geolocation Field 8.3

Test MapProviders.

File

tests/src/Functional/GeolocationSchemaCoverageTest.php, line 41

Class

GeolocationSchemaCoverageTest
Tests the grid style plugin.

Namespace

Drupal\Tests\geolocation\Functional

Code

public function testMapProvidersDefaults() {

  /** @var \Drupal\geolocation\MapProviderManager $mapProviderManager */
  $mapProviderManager = \Drupal::service('plugin.manager.geolocation.mapprovider');
  $mapProviderIds = $mapProviderManager
    ->getDefinitions();
  $view = View::load('geolocation_demo_common_map');
  foreach ($mapProviderIds as $mapProviderId => $definition) {
    $mapProvider = $mapProviderManager
      ->getMapProvider($mapProviderId);
    $display =& $view
      ->getDisplay('default');
    $display['display_options']['style']['options']['map_provider_id'] = $mapProviderId;
    $display['display_options']['style']['options']['map_provider_settings'] = $mapProvider
      ->getSettings([]);
    $view
      ->save();
    $this
      ->drupalGet('geolocation-demo/common-map');
    $this
      ->assertSession()
      ->statusCodeEquals(200);
  }
}