You are here

public function NodeCommentsTest::testNewComments in Drupal 9

Same name and namespace in other branches
  1. 8 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() {
  $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.');
}