You are here

function CommentNonNodeTest::getUnapprovedComment in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Tests/CommentNonNodeTest.php \Drupal\comment\Tests\CommentNonNodeTest::getUnapprovedComment()

Gets the comment ID for an unapproved comment.

Parameters

string $subject: Comment subject to find.

Return value

integer Comment ID.

File

core/modules/comment/src/Tests/CommentNonNodeTest.php, line 246
Contains \Drupal\comment\Tests\CommentNonNodeTest.

Class

CommentNonNodeTest
Tests commenting on a test entity.

Namespace

Drupal\comment\Tests

Code

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