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. 10 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.

Parameters

int $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 161

Class

CommentThreadingTest
Tests to make sure the comment number increments properly.

Namespace

Drupal\Tests\comment\Functional

Code

protected function assertNoParentLink($cid) {
    // This pattern matches a markup structure like:
    // <a id="comment-2"></a>
    // <article>
    //   <p class="parent"></p>
    //  </article>
    $pattern = "//article[@id='comment-{$cid}']//p[contains(@class, 'parent')]";
    $this->assertNoFieldByXpath($pattern, NULL, new FormattableMarkup('Comment %cid does not have a link to a parent.', [
        '%cid' => $cid,
    ]));
}

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