function OpenLayersStyles::testOpenLayersStyles in Openlayers 7.2
Same name and namespace in other branches
- 6.2 tests/openlayers.test \OpenLayersStyles::testOpenLayersStyles()
File
- tests/
openlayers.test, line 191 - Main OpenLayers Test file
Class
- OpenLayersStyles
- Test OpenLayers styles.
Code
function testOpenLayersStyles() {
$user = $this
->drupalCreateUser(array(
'administer openlayers',
));
$this
->drupalLogin($user);
// New style.
$new_style = array(
'name' => 'unitstyle',
'title' => 'Unit Style',
'description' => 'Unit Style for Drupal',
);
// Check basic navigation.
$this
->drupalGet('admin/structure/openlayers/styles/list/default/export');
$this
->assertResponse(200, t('User can reach default style export page.'));
$this
->drupalGet('admin/structure/openlayers/styles/add');
$this
->assertResponse(200, t('User can reach style add page.'));
// Add new style.
$this
->drupalPost('admin/structure/openlayers/styles/add', $new_style, t('Save'));
$this
->assertText(t('Style saved.'), t('The style was successfully saved.'));
// Test that the style shows up in the style list.
$this
->drupalGet('admin/structure/openlayers/styles');
$this
->assertRaw(t('Unit Style'), t('A new style has been added by the test'));
// Test removing style.
$this
->drupalPost('admin/structure/openlayers/styles/list/unitstyle/delete', array(), t('Delete'));
$this
->assertText('Style was deleted.', t('Style removed succesfully.'));
}