function CommentTestBase::performCommentOperation in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\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.
2 calls to CommentTestBase::performCommentOperation()
- CommentAdminTest::testApprovalAdminInterface in core/
modules/ comment/ src/ Tests/ CommentAdminTest.php - Test comment approval functionality through admin/content/comment.
- CommentAnonymousTest::testAnonymous in core/
modules/ comment/ src/ Tests/ CommentAnonymousTest.php - Tests anonymous comment functionality.
File
- core/
modules/ comment/ src/ Tests/ CommentTestBase.php, line 355 - Contains \Drupal\comment\Tests\CommentTestBase.
Class
- CommentTestBase
- Provides setup and helper methods for comment tests.
Namespace
Drupal\comment\TestsCode
function performCommentOperation(CommentInterface $comment, $operation, $approval = FALSE) {
$edit = array();
$edit['operation'] = $operation;
$edit['comments[' . $comment
->id() . ']'] = TRUE;
$this
->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
if ($operation == 'delete') {
$this
->drupalPostForm(NULL, array(), t('Delete comments'));
$this
->assertRaw(\Drupal::translation()
->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array(
'@operation' => $operation,
)));
}
else {
$this
->assertText(t('The update has been performed.'), format_string('Operation "@operation" was performed on comment.', array(
'@operation' => $operation,
)));
}
}