1 comment.test CommentActionsTestCase::testCommentPublishUnpublishActions()

Tests comment publish and unpublish actions.

File

core/modules/comment/tests/comment.test, line 1964
Tests for the Comment module.

Class

CommentActionsTestCase
Tests actions provided by the Comment module.

Code

function testCommentPublishUnpublishActions() {
  $this->backdropLogin($this->web_user);
  $comment_text = $this->randomName();
  $subject = $this->randomName();
  $comment = $this->postComment($this->node, $comment_text, '');
  $comment = comment_load($comment->id);

  comment_unpublish_action($comment);
  $this->assertEqual(comment_load($comment->cid)->status, COMMENT_NOT_PUBLISHED, 'Comment was unpublished');

  comment_publish_action($comment);
  $this->assertEqual(comment_load($comment->cid)->status, COMMENT_PUBLISHED, 'Comment was published');
}