| 7 search.test | SearchCommentCountToggleTestCase::testSearchCommentCountToggle() |
| 8 search.test | SearchCommentCountToggleTestCase::testSearchCommentCountToggle() |
Verify that comment count display toggles properly on comment status of node
File
- modules/
search/ search.test, line 1069 - Tests for search.module.
Code
function testSearchCommentCountToggle() {
// Search for the nodes by string in the node body.
$edit = array(
'search_block_form' => "'SearchCommentToggleTestCase'",
);
// Test comment count display for nodes with comment status set to Open
$this->drupalPost('', $edit, t('Search'));
$this->assertText(t('0 comments'), t('Empty comment count displays for nodes with comment status set to Open'));
$this->assertText(t('1 comment'), t('Non-empty comment count displays for nodes with comment status set to Open'));
// Test comment count display for nodes with comment status set to Closed
$this->searchable_nodes['0 comments']->comment = COMMENT_NODE_CLOSED;
node_save($this->searchable_nodes['0 comments']);
$this->searchable_nodes['1 comment']->comment = COMMENT_NODE_CLOSED;
node_save($this->searchable_nodes['1 comment']);
$this->drupalPost('', $edit, t('Search'));
$this->assertNoText(t('0 comments'), t('Empty comment count does not display for nodes with comment status set to Closed'));
$this->assertText(t('1 comment'), t('Non-empty comment count displays for nodes with comment status set to Closed'));
// Test comment count display for nodes with comment status set to Hidden
$this->searchable_nodes['0 comments']->comment = COMMENT_NODE_HIDDEN;
node_save($this->searchable_nodes['0 comments']);
$this->searchable_nodes['1 comment']->comment = COMMENT_NODE_HIDDEN;
node_save($this->searchable_nodes['1 comment']);
$this->drupalPost('', $edit, t('Search'));
$this->assertNoText(t('0 comments'), t('Empty comment count does not display for nodes with comment status set to Hidden'));
$this->assertNoText(t('1 comment'), t('Non-empty comment count does not display for nodes with comment status set to Hidden'));
}
Login or register to post comments