// Create a node and three comments.
$node =
$this->
drupalCreateNode(['type' => 'article', 'promote' => 1
]);
$comments =
[];
$comments[] =
$this->
postComment($node,
$this->
randomMachineName(),
$this->
randomMachineName(), TRUE
);
$comments[] =
$this->
postComment($node,
$this->
randomMachineName(),
$this->
randomMachineName(), TRUE
);
$comments[] =
$this->
postComment($node,
$this->
randomMachineName(),
$this->
randomMachineName(), TRUE
);
$this->
setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_FLAT, 'Comment paging changed.'
);
// Set "Comments per page" as zero and verify that all comments are appearing
// on the page.
$this->
setCommentsPerPage(0
);
$this->
drupalGet('node/' .
$node->
id());
$this->
assertTrue($this->
commentExists($comments[0
]), 'Comment 1 appears on page.'
);
$this->
assertTrue($this->
commentExists($comments[1
]), 'Comment 2 appears on page.'
);
$this->
assertTrue($this->
commentExists($comments[2
]), 'Comment 3 appears on page.'
);
// Set comments to one per page so that we are able to test paging without
// needing to insert large numbers of comments.
$this->
setCommentsPerPage(1
);
// Check the first page of the node, and confirm the correct comments are
// shown.