You are here

function NodeDisplaysPlugins::testPlugins in Node displays 6

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

Tests for plugins.

File

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

Class

NodeDisplaysPlugins
@file Tests for Node displays (plugins)

Code

function testPlugins() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer content types',
    'administer nodes',
  ));
  $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/content/types/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/content/node-type/page/display', $edit, t('Save'));

  // Test that footer is not rendered with the emptyregionrender plugin enabled.
  $this
    ->drupalGet('node/' . $page_node->nid);
  $this
    ->assertNoRaw('nd-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/content/node-type/page/display', $edit, t('Save'));

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