function NodeCommentsTest::testNewComments

Same name in other branches
  1. 9 core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php \Drupal\Tests\comment\Functional\Views\NodeCommentsTest::testNewComments()
  2. 8.9.x core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php \Drupal\Tests\comment\Functional\Views\NodeCommentsTest::testNewComments()
  3. 10 core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php \Drupal\Tests\comment\Functional\Views\NodeCommentsTest::testNewComments()

Tests the new comments field plugin.

File

core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php, line 34

Class

NodeCommentsTest
Tests comments on nodes.

Namespace

Drupal\Tests\comment\Functional\Views

Code

public function testNewComments() : void {
    $this->drupalGet('test-new-comments');
    $this->assertSession()
        ->statusCodeEquals(200);
    $new_comments = $this->cssSelect(".views-field-new-comments a:contains('1')");
    $this->assertCount(1, $new_comments, 'Found the number of new comments for a certain node.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.