class Test in Mail System 8.4
Provides a test plugin to send emails.
Hierarchy
- class \Drupal\Tests\mailsystem\Unit\Test implements MailInterface
Expanded class hierarchy of Test
File
- tests/
src/ Unit/ AdapterTest.php, line 88
Namespace
Drupal\Tests\mailsystem\UnitView source
class Test implements MailInterface {
const TEST_SUBJECT = 'Subject';
const TEST_BODY = 'Vivamus varius commodo leo at eleifend. Nunc vestibulum dolor eget turpis pulvinar volutpat.';
const TEST_HEADER_NAME = 'X-System';
const TEST_HEADER_VALUE = 'D8 PHP Unit test';
const SEND_SUCCESS_SUBJECT = 'Failed';
/**
* {@inheritdoc}
*/
public function format(array $message) {
return [
'subject' => self::TEST_SUBJECT,
'body' => self::TEST_BODY,
'headers' => [
self::TEST_HEADER_NAME => self::TEST_HEADER_VALUE,
],
];
}
/**
* {@inheritdoc}
*/
public function mail(array $message) {
return $message['subject'] == self::SEND_SUCCESS_SUBJECT;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Test:: |
public | function |
Formats a message prior to sending. Overrides MailInterface:: |
|
Test:: |
public | function |
Sends a message composed by \Drupal\Core\Mail\MailManagerInterface->mail(). Overrides MailInterface:: |
|
Test:: |
constant | |||
Test:: |
constant | |||
Test:: |
constant | |||
Test:: |
constant | |||
Test:: |
constant |