protected function WebTestBase::drupalGetMails in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::drupalGetMails()
Gets an array containing all emails sent during this test case.
Parameters
$filter: An array containing key/value pairs used to filter the emails that are returned.
Return value
An array containing email messages captured during the current test.
13 calls to WebTestBase::drupalGetMails()
- ConfigTranslationUiTest::testContactConfigEntityTranslation in core/
modules/ config_translation/ src/ Tests/ ConfigTranslationUiTest.php - Tests the contact form translation.
- ContactPersonalTest::testSendPersonalContactMessage in core/
modules/ contact/ src/ Tests/ ContactPersonalTest.php - Tests that mails for contact messages are correctly sent.
- ContactSitewideTest::testAutoReply in core/
modules/ contact/ src/ Tests/ ContactSitewideTest.php - Tests auto-reply on the site-wide contact form.
- ContactSitewideTest::testSiteWideContact in core/
modules/ contact/ src/ Tests/ ContactSitewideTest.php - Tests configuration options and the site-wide contact form.
- MailCaptureTest::testMailSend in core/
modules/ simpletest/ src/ Tests/ MailCaptureTest.php - Test to see if the wrapper function is executed correctly.
File
- core/
modules/ simpletest/ src/ WebTestBase.php, line 2663 - Contains \Drupal\simpletest\WebTestBase.
Class
- WebTestBase
- Test case for typical Drupal tests.
Namespace
Drupal\simpletestCode
protected function drupalGetMails($filter = array()) {
$captured_emails = \Drupal::state()
->get('system.test_mail_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;
}