You are here

openlayers.test in Openlayers 6

Main OpenLayers Test file

This file contains the tests for the openlayers module. Please note that since this module depends heavily on Javascript, these tests are limited in ensuring that the OpenLayers module functions 100% correctly.

File

tests/openlayers.test
View source
<?php

/**
 * @file
 * Main OpenLayers Test file
 *
 * This file contains the tests for the openlayers
 * module.  Please note that since this module
 * depends heavily on Javascript, these tests are
 * limited in ensuring that the OpenLayers module
 * functions 100% correctly.
 *
 * @ingroup openlayers
 */

/**
 * Test OpenLayers presets.
 */
class OpenLayersPresetsHook extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'OpenLayers Presets Hook',
      'description' => 'Tests the OpenLayers Preset hook.',
      'group' => 'OpenLayers',
    );
  }
  function setUp() {

    // Install modules
    parent::setUp('openlayers', 'openlayers_presets_ui', 'openlayers_test');
  }

  /**
   * Ensure that the preset shows up in the interface
   */
  function testOpenLayersPresetsHook() {
    $user = $this
      ->drupalCreateUser(array(
      'administer openlayers',
    ));
    $this
      ->drupalLogin($user);

    // Go to preset page
    $this
      ->drupalGet('admin/settings/openlayers/presets/list');
    $this
      ->assertResponse(200, t('Assert that user can reach and access preset list.'));

    // Ensure that the default test is listed
    $this
      ->assertText(t('Default Map'), t('Assert that the default preset\'s title appears.'));
    $this
      ->assertText(t('This is the default map preset that comes with the OpenLayers module.'), t('Assert that the default preset\'s description appears.'));
  }

}

Related topics

Classes

Namesort descending Description
OpenLayersPresetsHook Test OpenLayers presets.