function CommentThreadingTest::assertNoParentLink

Same name in other branches
  1. 9 core/modules/comment/tests/src/Functional/CommentThreadingTest.php \Drupal\Tests\comment\Functional\CommentThreadingTest::assertNoParentLink()
  2. 8.9.x core/modules/comment/tests/src/Functional/CommentThreadingTest.php \Drupal\Tests\comment\Functional\CommentThreadingTest::assertNoParentLink()
  3. 11.x core/modules/comment/tests/src/Functional/CommentThreadingTest.php \Drupal\Tests\comment\Functional\CommentThreadingTest::assertNoParentLink()

Asserts that the specified comment does not have a link to a parent.

@internal

Parameters

string $cid: The comment ID to check.

1 call to CommentThreadingTest::assertNoParentLink()
CommentThreadingTest::testCommentThreading in core/modules/comment/tests/src/Functional/CommentThreadingTest.php
Tests the comment threading.

File

core/modules/comment/tests/src/Functional/CommentThreadingTest.php, line 166

Class

CommentThreadingTest
Tests to make sure the comment number increments properly.

Namespace

Drupal\Tests\comment\Functional

Code

protected function assertNoParentLink(string $cid) : void {
    $pattern = "//article[@id='comment-{$cid}']";
    // A parent link is always accompanied by the text "In reply to".
    $this->assertSession()
        ->elementTextNotContains('xpath', $pattern, 'In reply to');
}

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