1 comment_views_handler_argument_user_uid.test public CommentViewsHandlerArgumentUserUidTest::postComment($node, $comment = array())

Post comment.

Parameters

object $node: Node to post comment on.

array $comment: Comment to save.

File

core/modules/comment/tests/comment_views_handler_argument_user_uid.test, line 43
Definition of CommentViewsHandlerArgumentUserUidTest.

Class

CommentViewsHandlerArgumentUserUidTest
Tests the argument_comment_user_uid handler.

Code

public function postComment($node, $comment = array()) {
  $comment += array(
    'uid' => $this->loggedInUser->uid,
    'nid' => $node->nid,
    'cid' => NULL,
    // To indicate that a comment does not have a parent comment use the value
    // zero instead of an empty string.
    'pid' => 0,
  );
  $comment = entity_create('comment', $comment);
  return comment_save($comment);
}