function SkinrUIPluginTestCase::testComment in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr_ui/src/Tests/skinr_ui.test \SkinrUIPluginTestCase::testComment()
Tests comment plugin.
File
- tests/
skinr_ui.test, line 608 - Tests for the Skinr UI module.
Class
- SkinrUIPluginTestCase
- Tests UI functionality for Block plugin.
Code
function testComment() {
$default_theme = variable_get('theme_default', 'bartik');
// Create a node.
$node1 = $this
->drupalCreateNode(array(
'type' => 'page',
));
// Go to node.
$uri = entity_uri('node', $node1);
$this
->drupalGet($uri['path']);
// Add a comment to the node. With bartik the contextual links won't
// display until there is at least one comment.
$edit = array(
'comment_body[und][0][value]' => $this
->randomString(128),
);
$this
->drupalPost(NULL, $edit, t('Save'));
// Make sure our contextual link appears on the page.
$this
->assertLinkByHref('admin/structure/skinr/edit/comment/page/configure', 0, 'Contexual link to edit comment\'s skin configuration was found.');
// Make sure this block's options are returned.
$this
->drupalGet('admin/structure/skinr/add');
$this
->assertOptionExists('element', 'page', 'Node type was returned by node_skinr_ui_element_options().');
// Test the returned element title.
$skin = (object) array(
'theme' => $default_theme,
'module' => 'comment',
'element' => 'page',
'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, 'Basic page', 'Node type title was returned.');
}