You are here

function CommentModuleTestCase::perform_comment_operation in SimpleTest 6

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.:

1 call to CommentModuleTestCase::perform_comment_operation()
CommentModuleTestCase::testAnonymous in tests/comment_module.test
Test anonymous comment functionality.

File

tests/comment_module.test, line 349

Class

CommentModuleTestCase

Code

function perform_comment_operation($comment, $operation, $approval = FALSE) {
  $edit = array();
  $edit['operation'] = $operation;
  $edit['comments[' . $comment->id . ']'] = TRUE;
  $this
    ->drupalPost('admin/content/comment' . ($approval ? '/approval' : ''), $edit, 'Update');
  if ($operation == 'delete') {
    $this
      ->drupalPost(NULL, array(), 'Delete comments');
    $this
      ->assertText(t('The comments have been deleted.'), 'Operation "' . $operation . '" was performed on comment.');
  }
  else {
    $this
      ->assertText(t('The update has been performed.'), 'Operation "' . $operation . '" was performed on comment.');
  }
}