$returned_page = \Drupal::
entityTypeManager()->
getStorage('comment'
) ->
getNewCommentPageNumber($node->
get('comment'
)->comment_count,
$new_replies,
$node, 'comment'
);
$this->
assertEquals($expected_page,
$returned_page,
new FormattableMarkup('Threaded mode, @new replies: expected page @expected, returned page @returned.',
['@new' =>
$new_replies, '@expected' =>
$expected_page, '@returned' =>
$returned_page]));
} } /**
* Confirms comment paging works correctly with two pagers.
*/
public function testTwoPagers() { // Add another field to article content-type.
$this->
addDefaultCommentField('node', 'article', 'comment_2'
);
// Set default to display comment list with unique pager id.
\Drupal::
service('entity_display.repository'
) ->
getViewDisplay('node', 'article'
) ->
setComponent('comment_2',
[ 'label' => 'hidden',
'type' => 'comment_default',
'weight' => 30,
'settings' =>
[ 'pager_id' => 1,
'view_mode' => 'default',
],
])