You are here

protected function MailTest::getLatestMaillogEntry in Maillog / Mail Developer 8

Gets the latest Maillog entry.

Return value

array Maillog entry.

2 calls to MailTest::getLatestMaillogEntry()
MailTest::testLogging in tests/src/Kernel/MailTest.php
Tests logging mail with maillog module.
MailTest::testLongSubject in tests/src/Kernel/MailTest.php
Confirm what happens with long subject lines.

File

tests/src/Kernel/MailTest.php, line 70

Class

MailTest
Tests the maillog plugin.

Namespace

Drupal\Tests\maillog\Kernel

Code

protected function getLatestMaillogEntry() {
  $result = \Drupal::database()
    ->queryRange('SELECT id, header_from, header_to, header_reply_to, header_all, subject, body
      FROM {maillog}
      ORDER BY id DESC', 0, 1);
  if ($maillog = $result
    ->fetchAssoc()) {

    // Unserialize values.
    $maillog['header_all'] = unserialize($maillog['header_all']);
  }
  return $maillog;
}