summaryrefslogtreecommitdiff
path: root/modules/search
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-12-04 01:47:00 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-12-04 01:47:00 +0000
commit3ee6f6bbc578ecd2f9d0b581bfa9b6e1abac40dd (patch)
tree183fc812676543660c589701be499a59bd36f55c /modules/search
parentaee64c551a51e8c1b9555abc6dc9af9fcd7f5842 (diff)
downloadbrdo-3ee6f6bbc578ecd2f9d0b581bfa9b6e1abac40dd.tar.gz
brdo-3ee6f6bbc578ecd2f9d0b581bfa9b6e1abac40dd.tar.bz2
#903392 by jhodgdon, rayasa: Fixed 'Add new comment' text appears in search result snippet
Diffstat (limited to 'modules/search')
-rw-r--r--modules/search/search.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/search/search.test b/modules/search/search.test
index 45da4647f..d5aacda92 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -871,6 +871,42 @@ class SearchCommentTestCase extends DrupalWebTestCase {
$this->{$method}($this->comment_subject, "Comment subject $verb in search results: " . $message);
}
+ /**
+ * Verify that 'add new comment' does not appear in search results or index.
+ */
+ function testAddNewComment() {
+ // Create a node with a short body.
+ $settings = array(
+ 'type' => 'article',
+ 'title' => 'short title',
+ 'body' => array(LANGUAGE_NONE => array(array('value' => 'short body text'))),
+ );
+
+ $user = $this->drupalCreateUser(array('search content', 'create article content', 'access content'));
+ $this->drupalLogin($user);
+
+ $node = $this->drupalCreateNode($settings);
+ // Verify that if you view the node on its own page, 'add new comment'
+ // is there.
+ $this->drupalGet('node/' . $node->nid);
+ $this->assertText(t('Add new comment'), t('Add new comment appears on node page'));
+
+ // Run cron to index this page.
+ $this->drupalLogout();
+ $this->cronRun();
+
+ // Search for 'comment'. Should be no results.
+ $this->drupalLogin($user);
+ $this->drupalPost('search/node', array('keys' => 'comment'), t('Search'));
+ $this->assertText(t('Your search yielded no results'), t('No results searching for the word comment'));
+
+ // Search for the node title. Should be found, and 'Add new comment' should
+ // not be part of the search snippet.
+ $this->drupalPost('search/node', array('keys' => 'short'), t('Search'));
+ $this->assertText($node->title, t('Search for keyword worked'));
+ $this->assertNoText(t('Add new comment'), t('Add new comment does not appear on search results page'));
+ }
+
}
/**