You are here

function NodeDisplaysPlugins::testPlugins in Node displays 7

Same name and namespace in other branches
  1. 6.3 tests/nd.plugins.test \NodeDisplaysPlugins::testPlugins()
  2. 6 tests/nd.plugins.test \NodeDisplaysPlugins::testPlugins()
  3. 6.2 tests/nd.plugins.test \NodeDisplaysPlugins::testPlugins()

Tests for plugins.

File

tests/nd.plugins.test, line 43
Tests for Node displays (plugins)

Class

NodeDisplaysPlugins
@file Tests for Node displays (plugins)

Code

function testPlugins() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer nodes',
    'access display suite',
    'administer nd',
    'configure layout for nd',
    'export and import settings',
    'revert overridden settings',
    'use PHP in custom fields',
  ));
  $this
    ->drupalLogin($admin_user);
  $plugin_settings = variable_get('nd_plugin_settings', array());
  $this
    ->assertEqual($plugin_settings, array(), t('Plugin settings is empty'), t('Plugin tests'));

  // Enable the emptyregionrender plugin.
  $edit = array(
    'plugin_emptyregionrender' => TRUE,
  );
  $this
    ->drupalPost('admin/ds/nd/plugins', $edit, t('Save'));
  $plugin_settings = variable_get('nd_plugin_settings', array());
  $this
    ->assertTrue(isset($plugin_settings['emptyregionrender']), t('Empty region render enabled.'), t('Plugin tests'));
  $page_node = $this
    ->drupalCreateNode();

  // First post.
  $edit = array(
    'title[full][region]' => 'header',
    'author[full][region]' => 'middle',
    'body[full][region]' => 'middle',
  );
  $this
    ->drupalPost('admin/ds/layout/page/full', $edit, t('Save'));

  // Test that footer is not rendered with the emptyregionrender plugin enabled.
  $this
    ->drupalGet('node/' . $page_node->nid);
  $this
    ->assertNoRaw('ds-region-footer', t('Footer is not rendered.'), t('Plugin tests'));

  // Save again.
  $edit = array(
    'title[full][region]' => 'header',
    'author[full][region]' => 'middle',
    'body[full][region]' => 'middle',
    'emptyregionrender[region-render-footer]' => TRUE,
  );
  $this
    ->drupalPost('admin/ds/layout/page/full', $edit, t('Save'));

  // Test that footer is rendered with the emptyregionrender plugin enabled.
  $this
    ->drupalGet('node/' . $page_node->nid);
  $this
    ->assertRaw('ds-region-footer', t('Footer is rendered.'), t('Plugin tests'));
}