function CommentNonNodeTest::performCommentOperation
Same name in other branches
- 8.9.x core/modules/comment/tests/src/Functional/CommentNonNodeTest.php \Drupal\Tests\comment\Functional\CommentNonNodeTest::performCommentOperation()
- 10 core/modules/comment/tests/src/Functional/CommentNonNodeTest.php \Drupal\Tests\comment\Functional\CommentNonNodeTest::performCommentOperation()
- 11.x core/modules/comment/tests/src/Functional/CommentNonNodeTest.php \Drupal\Tests\comment\Functional\CommentNonNodeTest::performCommentOperation()
Performs the specified operation on the specified comment.
Parameters
object $comment: Comment to perform operation on.
string $operation: Operation to perform.
bool $approval: Operation is found on approval page.
1 call to CommentNonNodeTest::performCommentOperation()
- CommentNonNodeTest::testCommentFunctionality in core/
modules/ comment/ tests/ src/ Functional/ CommentNonNodeTest.php - Tests anonymous comment functionality.
File
-
core/
modules/ comment/ tests/ src/ Functional/ CommentNonNodeTest.php, line 231
Class
- CommentNonNodeTest
- Tests commenting on a test entity.
Namespace
Drupal\Tests\comment\FunctionalCode
public function performCommentOperation($comment, $operation, $approval = FALSE) {
$edit = [];
$edit['operation'] = $operation;
$edit['comments[' . $comment->id() . ']'] = TRUE;
$this->drupalGet('admin/content/comment' . ($approval ? '/approval' : ''));
$this->submitForm($edit, 'Update');
if ($operation == 'delete') {
$this->submitForm([], 'Delete');
$this->assertSession()
->pageTextContains('Deleted 1 comment.');
}
else {
$this->assertSession()
->pageTextContains('The update has been performed.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.