You are here

function OpenLayersUI::testSourceChange in Openlayers 7.2

Ensure that the source can be updated

File

tests/openlayers.test, line 87
Main OpenLayers Test file

Class

OpenLayersUI
Test OpenLayers basic UI

Code

function testSourceChange() {
  $user = $this
    ->drupalCreateUser(array(
    'administer openlayers',
  ));
  $this
    ->drupalLogin($user);

  // Update source settings
  $new_openlayers_source = 'http://openlayers.org/nightly/OpenLayers.js';
  $openlayers_settings = array(
    'openlayers_source_type' => 'external',
    'openlayers_source_external' => $new_openlayers_source,
  );
  $this
    ->drupalPost('admin/structure/openlayers', $openlayers_settings, t('Save configuration'));

  // Go to map page
  $this
    ->drupalGet('admin/structure/openlayers');
  $this
    ->assertResponse(200, t('User can reach the settings page.'));

  // Check that the new source change is represented
  $this
    ->drupalGet('admin/structure/openlayers');
  $this
    ->assertRaw($new_openlayers_source, t('The OpenLayers source was changed'));
}