messaging_methods.test in Messaging 5
File
tests/messaging_methods.test
View source
<?php
require_once 'messaging_testcase.inc';
class Messaging_Methods_Tests extends MessagingTestCase {
function get_info() {
return array(
'name' => 'Sending methods',
'group' => 'Messaging',
'desc' => 'API compatibility for sending method plug-ins',
);
}
function testMessagingMethods() {
$this
->messagingStartTest();
$start_time = time();
$this
->drupalModuleEnable('messaging_debug');
$this
->drupalVariableSet('messaging_debug', 0);
$user = $this
->drupalCreateUserRolePerm(array());
$count = 0;
foreach (messaging_method_info() as $method => $info) {
$name = $info['name'];
$message = $this
->randomMessage();
$this
->assertEqual(messaging_message_send_user($user, $message, $method, TRUE), TRUE, 'Message sent for user using: ' . $name);
$this
->assertEqual(messaging_message_send(array(
$user,
$user,
), $message, $method, TRUE), TRUE, 'Bulk messages sent using: ' . $name);
$queued = messaging_store('get', array(
'uid' => $user->uid,
'method' => $method,
));
$this
->assertEqual(count($queued), 3, 'The right number of messages have been queued for method: ' . $name . ' (' . count($queued) . ')');
}
$this
->messagingCleanUp();
}
}