You are here

function OpenLayersMaps::testMapAdd in Openlayers 7.2

Add a new map

File

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

Class

OpenLayersMaps
Test OpenLayers maps.

Code

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

  // Add new map.  Add scaleline so we can look for it later
  $map_settings = array(
    'name' => 'testing_map',
    'title' => t('Testing Map'),
    'description' => t('Testing Map description.'),
    'behaviors[openlayers_behavior_scaleline][enabled]' => TRUE,
  );
  $this
    ->drupalPost('admin/structure/openlayers/maps/add', $map_settings, t('Save'));
  $this
    ->assertText(t('Map saved.'), t('The map was successfully saved.'));

  // Remove Map
  $this
    ->drupalPost('admin/structure/openlayers/maps/list/' . $map_settings['name'] . '/delete', array(), t('Delete'));
  $this
    ->assertText('Map was deleted.', t('Map removed succesfully.'));
}