protected function WebTestBase::drupalGetMails

Gets an array containing all e-mails sent during this test case.

Parameters

$filter: An array containing key/value pairs used to filter the e-mails that are returned.

Return value

An array containing e-mail messages captured during the current test.

9 calls to WebTestBase::drupalGetMails()

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php, line 2021
Definition of Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function drupalGetMails($filter = array()) {
  $captured_emails = state()
    ->get('system.test_email_collector') ?: array();
  $filtered_emails = array();
  foreach ($captured_emails as $message) {
    foreach ($filter as $key => $value) {
      if (!isset($message[$key]) || $message[$key] != $value) {
        continue 2;
      }
    }
    $filtered_emails[] = $message;
  }
  return $filtered_emails;
}