public function DefaultViewRecentComments::testPageDisplay in Views (for Drupal 7) 8.3
Tests the page defined by the comments_recent view.
File
- lib/
Drupal/ views/ Tests/ Comment/ DefaultViewRecentComments.php, line 129 - Definition of Drupal\views\Tests\Comment\DefaultViewRecentComments.
Class
Namespace
Drupal\views\Tests\CommentCode
public function testPageDisplay() {
$view = views_get_view('comments_recent');
$view
->setDisplay('page');
$this
->executeView($view);
$map = array(
'comment_nid' => 'nid',
'comment_subject' => 'subject',
'comment_changed' => 'changed',
'comment_changed' => 'created',
'cid' => 'cid',
);
$expected_result = array();
foreach (array_values($this->commentsCreated) as $key => $comment) {
$expected_result[$key]['nid'] = $comment->nid;
$expected_result[$key]['subject'] = $comment->subject;
$expected_result[$key]['changed'] = $comment->changed;
$expected_result[$key]['created'] = $comment->created;
$expected_result[$key]['cid'] = $comment->cid;
}
$this
->assertIdenticalResultset($view, $expected_result, $map);
// Check the number of results given by the display is the expected.
$this
->assertEqual(count($view->result), $this->pageDisplayResults, format_string('There are exactly @results comments. Expected @expected', array(
'@results' => count($view->result),
'@expected' => $this->pageDisplayResults,
)));
}