You are here

public function CommentTestBase::getUnapprovedComment in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::getUnapprovedComment()

Gets the comment ID for an unapproved comment.

Parameters

string $subject: Comment subject to find.

Return value

int Comment id.

3 calls to CommentTestBase::getUnapprovedComment()
CommentAdminTest::testApprovalAdminInterface in core/modules/comment/tests/src/Functional/CommentAdminTest.php
Tests comment approval functionality through admin/content/comment.
CommentAdminTest::testApprovalAdminInterface in core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
Tests comment approval functionality through admin/content/comment.
CommentAdminTest::testApprovalNodeInterface in core/modules/comment/tests/src/Functional/CommentAdminTest.php
Tests comment approval functionality through the node interface.

File

core/modules/comment/tests/src/Functional/CommentTestBase.php, line 386

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\Tests\comment\Functional

Code

public function getUnapprovedComment($subject) {
  $this
    ->drupalGet('admin/content/comment/approval');
  preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this
    ->getSession()
    ->getPage()
    ->getContent(), $match);
  return $match[2];
}