// Page of comment 2
4 => 2,
// Page of comment 1
5 => 1,
// Page of comment 0
6 => 0,
];
$node = Node::
load($node->
id());
foreach ($expected_pages as $new_replies =>
$expected_page) { $returned_page = \Drupal::
entityTypeManager()->
getStorage('comment'
) ->
getNewCommentPageNumber($node->
get('comment'
)->comment_count,
$new_replies,
$node, 'comment'
);
$this->
assertSame($expected_page,
$returned_page,
new FormattableMarkup('Flat mode, @new replies: expected page @expected, returned page @returned.',
['@new' =>
$new_replies, '@expected' =>
$expected_page, '@returned' =>
$returned_page]));
} $this->
setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Switched to threaded mode.'
);
$expected_pages =
[ // Page of comment 5
1 => 5,
// Page of comment 4
2 => 1,
// Page of comment 4