You are here

public function TestNotify::testCreateOnlyUnpublishedArticles in Notify 7

File

./notify.test, line 183
Automated tests for notify.

Class

TestNotify

Code

public function testCreateOnlyUnpublishedArticles() {

  // 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', 0);
  variable_set('notify_send_hour', 9);
  variable_set('notify_batchsize', 100);
  $now = REQUEST_TIME;
  variable_set('notify_send_start', 0);

  // We haven't started
  $tt = $now - 86400;
  variable_set('notify_send_last', $tt);

  // Last was yesterday.
  $tt = $now + 86400;
  variable_set('notify_cron_next', $tt);

  // Next cron scheduled tomorrow.
  $this
    ->createContent(1, '', FALSE);
  $this
    ->createContent(1, $this->user->name, FALSE);
  $this
    ->createContent(1, NULL, FALSE);
  $this
    ->cronRun();
  $mails = $this
    ->drupalGetMails();
  $howmany = count($mails);
  $this
    ->assertEqual($howmany, 1, 'One email are sent.');
}