public function CommentTestBase::performCommentOperation in Drupal 10
Same name and namespace in other branches
- 8 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::performCommentOperation()
- 9 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::performCommentOperation()
Performs the specified operation on the specified comment.
Parameters
\Drupal\comment\CommentInterface $comment: Comment to perform operation on.
string $operation: Operation to perform.
bool $approval: Operation is found on approval page.
File
- core/
modules/ comment/ tests/ src/ Functional/ CommentTestBase.php, line 361
Class
- CommentTestBase
- Provides setup and helper methods for comment tests.
Namespace
Drupal\Tests\comment\FunctionalCode
public function performCommentOperation(CommentInterface $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.');
}
}