function OriginatorSubscriberTest::testDefaultEnvelopeSender
Ensure that the envelope sender is set to the site mail address.
File
-
core/
modules/ mailer/ tests/ src/ Kernel/ OriginatorSubscriberTest.php, line 256
Class
- OriginatorSubscriberTest
- Tests default originator subscriber.
Namespace
Drupal\Tests\mailer\KernelCode
public function testDefaultEnvelopeSender() : void {
$expectedAddress = Address::create('Example Site <site-mail@example.com>');
$email = (new Email())->subject('Score somebody wall science two.')
->text('Style simply eat. Too both light. Herself bill economic room impact.');
$transport = $this->container
->get(TransportInterface::class);
assert($transport instanceof TransportInterface);
$sentMessage = $transport->send($email->to('foobar@example.com'));
assert($sentMessage instanceof SentMessage);
$envelope = $sentMessage->getEnvelope();
$actualAddress = $envelope->getSender();
$this->assertEquals($expectedAddress, $actualAddress);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.