You are here

function CommentTestBase::getUnapprovedComment in Zircon Profile 8

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

Gets the comment ID for an unapproved comment.

Parameters

string $subject: Comment subject to find.

Return value

integer Comment id.

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

File

core/modules/comment/src/Tests/CommentTestBase.php, line 379
Contains \Drupal\comment\Tests\CommentTestBase.

Class

CommentTestBase
Provides setup and helper methods for comment tests.

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];
}