function MailTest::mailAlter

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Kernel/Mail/MailTest.php \Drupal\Tests\system\Kernel\Mail\MailTest::mailAlter()

Implements hook_mail_alter().

Aborts sending of messages with ID 'mail_cancel_test_cancel_test'.

Attributes

#[Hook('mail_alter')]

See also

::testCancelMessage()

File

core/modules/system/tests/src/Kernel/Mail/MailTest.php, line 108

Class

MailTest
Performs tests on the pluggable mailing framework.

Namespace

Drupal\Tests\system\Kernel\Mail

Code

public function mailAlter(&$message) : void {
  if ($message['id'] == 'mail_cancel_test_cancel_test') {
    $message['send'] = FALSE;
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.