You are here

function PrivatemsgEMailNotifyTestCase::getNewMails in Privatemsg 7.2

Same name and namespace in other branches
  1. 6.2 pm_email_notify/pm_email_notify.test \PrivatemsgEMailNotifyTestCase::getNewMails()

Return new mails.

Returns all mails which were sent since the last call to this function.

Parameters

$expectedNumber: Number of new mails that should be there.

6 calls to PrivatemsgEMailNotifyTestCase::getNewMails()
PrivatemsgEMailNotifyTestCase::testAlwaysConfiguration in pm_email_notify/pm_email_notify.test
Test Always configuration.
PrivatemsgEMailNotifyTestCase::testNeverConfiguration in pm_email_notify/pm_email_notify.test
Test that no mails are sent when
PrivatemsgEMailNotifyTestCase::testOnlyUserConfiguration in pm_email_notify/pm_email_notify.test
Test Always configuration.
PrivatemsgEMailNotifyTestCase::testThreadConfiguration in pm_email_notify/pm_email_notify.test
Test Always configuration.
PrivatemsgEMailNotifyTestCase::testUnreadConfiguration in pm_email_notify/pm_email_notify.test
Test Always configuration.

... See full list

File

pm_email_notify/pm_email_notify.test, line 463
Test file for pm_email_notify.module

Class

PrivatemsgEMailNotifyTestCase
@file Test file for pm_email_notify.module

Code

function getNewMails($expectedNumber) {

  // Load all mails of the current test.
  $mails = $this
    ->drupalGetMails();

  // Slice of the new ones.
  $mails_slice = array_slice($mails, $this->handledMails);

  // Update amount of already handled mails.
  $this->handledMails = count($mails);
  if ($expectedNumber !== FALSE) {
    $this
      ->assertEqual(count($mails_slice), $expectedNumber, t('@expected notification mails were sent.', array(
      '@expected' => $expectedNumber,
    )));
  }
  return $mails_slice;
}