You are here

function viewsHandlerArgumentCommentUserUidTest::postComment in Views (for Drupal 7) 7.3

Post comment.

Parameters

object $node: Node to post comment on.

array $comment: Comment to save.

1 call to viewsHandlerArgumentCommentUserUidTest::postComment()
viewsHandlerArgumentCommentUserUidTest::setUp in tests/comment/views_handler_argument_comment_user_uid.test
Sets up a Drupal site for running functional and integration tests.

File

tests/comment/views_handler_argument_comment_user_uid.test, line 29
Definition of viewsHandlerArgumentCommentUserUidTest.

Class

viewsHandlerArgumentCommentUserUidTest
Tests the argument_comment_user_uid handler.

Code

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,
  );
  return comment_save((object) $comment);
}