You are here

protected function CommentThreadingTest::assertNoParentLink in Drupal 9

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

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 156

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:
  // @code
  // <a id="comment-2"></a>
  // <article>
  //   <p class="parent"></p>
  // </article>
  // @endcode
  $pattern = "//article[@id='comment-{$cid}']//p[contains(@class, 'parent')]";
  $this
    ->assertSession()
    ->elementNotExists('xpath', $pattern);
}