You are here

function SkinrUIPluginTestCase::testNode in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 skinr_ui/src/Tests/skinr_ui.test \SkinrUIPluginTestCase::testNode()

Tests node plugin.

File

tests/skinr_ui.test, line 651
Tests for the Skinr UI module.

Class

SkinrUIPluginTestCase
Tests UI functionality for Block plugin.

Code

function testNode() {
  $default_theme = variable_get('theme_default', 'bartik');

  // Create a node.
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'article',
  ));

  // Go to node.
  $uri = entity_uri('node', $node);
  $this
    ->drupalGet($uri['path']);

  // Make sure our contextual link appears on the page.
  $this
    ->assertLinkByHref('admin/structure/skinr/edit/node/article/configure', 0, 'Contexual link to edit node\'s skin configuration was found.');

  // Make sure this block's options are returned.
  $this
    ->drupalGet('admin/structure/skinr/add');
  $this
    ->assertOptionExists('element', 'article', 'Node type was returned by node_skinr_ui_element_options().');

  // Test the returned element title.
  $skin = (object) array(
    'theme' => $default_theme,
    'module' => 'node',
    'element' => 'article',
    'skin' => 'skinr_ui_test_bgcolor',
    'options' => array(
      'bgcolor_red',
    ),
    'status' => 1,
  );
  skinr_skin_save($skin);
  $title = skinr_invoke_all('skinr_ui_element_title', $skin->module, $skin->element, $skin->theme);
  $title = reset($title);
  $this
    ->assertEqual($title, 'Article', 'Node type title was returned.');
}