You are here

function NotificationsTestCase::drupalCreateComment in Notifications 6.4

Same name and namespace in other branches
  1. 7 tests/notifications_test_case.inc \NotificationsTestCase::drupalCreateComment()
2 calls to NotificationsTestCase::drupalCreateComment()
NotificationsAnonymousTests::testAnonymousSubscriptions in tests/notifications_anonymous.test
NotificationsContentTests::testNotificationsContent in tests/notifications_content.test
Play with creating, retrieving, deleting a pair subscriptions

File

tests/notifications_test_case.inc, line 57
Base class for Notifications Tests

Class

NotificationsTestCase
@file Base class for Notifications Tests

Code

function drupalCreateComment($node, $comment = array()) {
  $comment += array(
    'subject' => $this
      ->randomName(8),
    'comment' => $this
      ->randomName(32),
    'uid' => $node->uid,
    'nid' => $node->nid,
    'status' => COMMENT_PUBLISHED,
    'cid' => 0,
    'pid' => 0,
    'format' => FILTER_FORMAT_DEFAULT,
  );
  $cid = comment_save($comment);
  $this
    ->assertTrue($cid, "Successfully created comment: {$cid} for node {$node->nid} ({$node->type}).");
  return _comment_load($cid);
}