1 node.test | public NodeAccessPagerTestCase::testCommentPager() |
Tests the comment pager for nodes with multiple grants per realm.
File
- core/
modules/ node/ tests/ node.test, line 3538 - Tests for node.module.
Class
- NodeAccessPagerTestCase
- Tests pagination with a node access module enabled.
Code
public function testCommentPager() {
// Create a node.
$node = $this->backdropCreateNode();
// Create 60 comments.
for ($i = 0; $i < 60; $i++) {
$comment = entity_create('comment', array(
'uid' => $this->web_user->uid,
'nid' => $node->nid,
'subject' => $this->randomName(),
'comment_body' => array(
LANGUAGE_NONE => array(
array('value' => $this->randomName()),
),
),
));
comment_save($comment);
}
$this->backdropLogin($this->web_user);
// View the node page. With the default 50 comments per page there should
// be two pages (0, 1) but no third (2) page.
$this->backdropGet('node/' . $node->nid);
$this->assertText($node->title);
$this->assertText('Comments');
$this->assertRaw('page=1');
$this->assertNoRaw('page=2');
}