You are here

function CommentHelperCase::performCommentOperation in Drupal 7

Perform the specified operation on the specified comment.

Parameters

object $comment: Comment to perform operation on.

string $operation: Operation to perform.

boolean $aproval: Operation is found on approval page.

2 calls to CommentHelperCase::performCommentOperation()
CommentAnonymous::testAnonymous in modules/comment/comment.test
Test anonymous comment functionality.
CommentApprovalTest::testApprovalAdminInterface in modules/comment/comment.test
Test comment approval functionality through admin/content/comment.

File

modules/comment/comment.test, line 234
Tests for comment.module.

Class

CommentHelperCase
@file Tests for comment.module.

Code

function performCommentOperation($comment, $operation, $approval = FALSE) {
  $edit = array();
  $edit['operation'] = $operation;
  $edit['comments[' . $comment->id . ']'] = TRUE;
  $this
    ->drupalPost('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
  if ($operation == 'delete') {
    $this
      ->drupalPost(NULL, array(), t('Delete comments'));
    $this
      ->assertRaw(format_plural(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,
    )));
  }
}