function OriginatorSubscriberTest::testDefaultFrom
Ensure that the from address is set to the site mail address.
File
-
core/
modules/ mailer/ tests/ src/ Kernel/ OriginatorSubscriberTest.php, line 57
Class
- OriginatorSubscriberTest
- Tests default originator subscriber.
Namespace
Drupal\Tests\mailer\KernelCode
public function testDefaultFrom() : void {
$expectedAddress = Address::create('Example Site <site-mail@example.com>');
$email = (new Email())->subject('Way house answer start behind old')
->text('We name know environmental along agree let. Traditional interest this clearly concern discover. Foot carry member your.');
$transport = $this->container
->get(TransportInterface::class);
assert($transport instanceof TransportInterface);
$sentMessage = $transport->send($email->to('foobar@example.com'));
assert($sentMessage instanceof SentMessage);
$originalEmail = $sentMessage->getOriginalMessage();
assert($originalEmail instanceof Email);
$actualFrom = $originalEmail->getFrom();
$this->assertEquals([
$expectedAddress,
], $actualFrom);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.