public function TestNotify::testOldAndNewArticles in Notify 7
File
- ./
notify.test, line 231 - Automated tests for notify.
Class
Code
public function testOldAndNewArticles() {
// Set up notify environment.
variable_set('notify_attempts', 5);
variable_set('notify_include_updates', 0);
variable_set('notify_reg_default', 1);
variable_set('notify_period', 600);
// every ten minutes
variable_set('notify_send_hour', 8);
variable_set('notify_batchsize', 100);
$now = REQUEST_TIME;
variable_set('notify_send_start', 0);
// reset
$tt = $now - 86400;
variable_set('notify_send_last', $tt);
// yesterday
variable_set('notify_cron_next', 0);
// reset
// Content is: 1 x old, 2 x 5 hour old
$fivehoursago = format_date($now - 18000, 'custom', 'Y-m-d H:i:s O');
$this
->createContent(1, NULL, TRUE, '2014-01-01 01:00:00 +0100');
$this
->createContent(2, NULL, TRUE, $fivehoursago);
$this
->cronRun();
$mails = $this
->drupalGetMails();
$howmany = count($mails);
$this
->assertEqual($howmany, 3, 'Three emails are sent.');
}