public function CommentNonNodeTest::getUnapprovedComment in Drupal 9
Same name and namespace in other branches
- 8 core/modules/comment/tests/src/Functional/CommentNonNodeTest.php \Drupal\Tests\comment\Functional\CommentNonNodeTest::getUnapprovedComment()
Gets the comment ID for an unapproved comment.
Parameters
string $subject: Comment subject to find.
Return value
int Comment ID.
File
- core/
modules/ comment/ tests/ src/ Functional/ CommentNonNodeTest.php, line 258
Class
- CommentNonNodeTest
- Tests commenting on a test entity.
Namespace
Drupal\Tests\comment\FunctionalCode
public function getUnapprovedComment($subject) {
$this
->drupalGet('admin/content/comment/approval');
preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this
->getSession()
->getPage()
->getContent(), $match);
return $match[2];
}