summaryrefslogtreecommitdiff
path: root/modules/comment/comment.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment/comment.test')
-rw-r--r--modules/comment/comment.test22
1 files changed, 21 insertions, 1 deletions
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index 095f04548..c1630d6dd 100644
--- a/modules/comment/comment.test
+++ b/modules/comment/comment.test
@@ -69,10 +69,20 @@ class CommentTestCase extends DrupalWebTestCase {
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName());
$this->assertTrue($this->commentExists($reply, TRUE), t('Modified reply found.'));
+ // Pager
+ $this->setCommentsPerPage(2);
+ $comment_new_page = $this->postComment($this->node, $this->randomName(), $this->randomName());
+ $this->drupalGet('node/' . $this->node->nid);
+ $this->assertTrue($this->commentExists($comment) && $this->commentExists($comment_new_page), t('Page one exists. %s'));
+ $this->drupalGet('node/' . $this->node->nid, array('query' => 'page=1'));
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s'));
+ $this->setCommentsPerPage(50);
+
// Delete comment and make sure that reply is also removed.
$this->drupalLogout();
$this->drupalLogin($this->admin_user);
$this->deleteComment($comment);
+ $this->deleteComment($comment_new_page);
$this->drupalGet('node/' . $this->node->nid);
$this->assertFalse($this->commentExists($comment), t('Comment not found.'));
@@ -294,7 +304,7 @@ class CommentTestCase extends DrupalWebTestCase {
$regex .= $comment->comment . '(.*?)'; // Match comment.
$regex .= '<\/div>/s'; // Dot matches newlines and ensure that match doesn't bleed outside comment div.
- return preg_match($regex, $this->drupalGetContent());
+ return (boolean)preg_match($regex, $this->drupalGetContent());
}
else {
return FALSE;
@@ -353,6 +363,16 @@ class CommentTestCase extends DrupalWebTestCase {
}
/**
+ * Set the default number of comments per page.
+ *
+ * @param integer $comments
+ * Comments per page value.
+ */
+ function setCommentsPerPage($number) {
+ $this->setCommentSettings('comment_default_per_page', $number, 'Number of comments per page set to ' . $number .'.');
+ }
+
+ /**
* Set comment setting for article content type.
*
* @param string $name