You are here

function NotificationsLiteTests::sendLiteMessages in Notifications 6.4

Same name and namespace in other branches
  1. 6.2 tests/notifications_lite.test \NotificationsLiteTests::sendLiteMessages()
  2. 6.3 tests/notifications_lite.test \NotificationsLiteTests::sendLiteMessages()
  3. 7 tests/notifications_lite.test \NotificationsLiteTests::sendLiteMessages()

Helper function to send messages and do queue processing

1 call to NotificationsLiteTests::sendLiteMessages()
NotificationsLiteTests::testNotificationsLite in tests/notifications_lite.test
Test simple sending cases

File

tests/notifications_lite.test, line 104

Class

NotificationsLiteTests

Code

function sendLiteMessages($uid, $count) {
  $messages = array();
  for ($i = 1; $i <= $count; $i++) {
    $msg = new Stdclass();
    $msg->subject = "Lite Subject {$i}";
    $msg->body = "Body for message {$i}";
    notifications_lite_send($uid, $msg->subject, $msg->body);
    $messages[$i] = $msg;
  }

  // There should be one queued notification and one event for each message
  $this
    ->assertUserRows('notifications_queue', $count, $uid, "We have {$count} notifications in queue");
  $rows = notifications_queue()
    ->process_rows(array(
    'uid' => $uid,
  ));
  $this
    ->assertEqual($count, $rows, "Processed all rows in queue ({$rows})");
  return $messages;
}