You are here

function _monitoring_setup_create_comment in Monitoring 7

Same name and namespace in other branches
  1. 8 modules/demo/monitoring_demo.install \_monitoring_setup_create_comment()

Creates comments for testing purposes.

Parameters

object $node: Node to which the comment belongs.

array $settings: Comment data.

Return value

object Crated comment.

1 call to _monitoring_setup_create_comment()
monitoring_demo_enable in test/monitoring_demo.install
Implements hook_enable().

File

./monitoring.setup.inc, line 138
Set up dependencies for demo and tests.

Code

function _monitoring_setup_create_comment($node, $settings = array()) {
  $settings += array(
    'status' => COMMENT_PUBLISHED,
    'node_type' => $node->type,
    'nid' => $node->nid,
  );
  $comment = entity_create('comment', $settings);
  comment_save($comment);
  return $comment;
}