You are here

function MailLoggerTest::testMailLoggerReadMail in Mail Logger 7

File

./mail_logger.test, line 32
Tests for the Mail Logger module.

Class

MailLoggerTest
@file Tests for the Mail Logger module.

Code

function testMailLoggerReadMail() {
  $user = $this
    ->drupalCreateUser(array(
    'access mail logger',
  ));
  $this
    ->drupalLogin($user);

  //Test failure
  $invalid_id = 99999;
  $this
    ->drupalGet('admin/reports/mail-logger/mail/' . $invalid_id);
  $this
    ->assertRaw('No Mail Logger record found with id:', t('Invalid mail ID message found'));

  //Send a test email

  //Test Success
  global $language_content;
  $language = $language_content;
  $params = array();
  $message = drupal_mail('simpletest', 'mail_test', 'testing@example.com', $language, $params, 'simpletest@example.com', FALSE);
  $this
    ->drupalGet('admin/reports/mail-logger/mail/1');
  $this
    ->assertRaw('Outgoing Mail log entries', t('Mail Message found'));
  $this
    ->assertRaw('testing@example.com', t('Test mail found'));
}