public function MailManagerTest::testMailInRenderContext in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php \Drupal\Tests\Core\Mail\MailManagerTest::testMailInRenderContext()
- 9 core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php \Drupal\Tests\Core\Mail\MailManagerTest::testMailInRenderContext()
Tests that mails are sent in a separate render context.
@covers ::mail
File
- core/
tests/ Drupal/ Tests/ Core/ Mail/ MailManagerTest.php, line 152 - Contains \Drupal\Tests\Core\Mail\MailManagerTest.
Class
- MailManagerTest
- @coversDefaultClass \Drupal\Core\Mail\MailManager @group Mail
Namespace
Drupal\Tests\Core\MailCode
public function testMailInRenderContext() {
$interface = [
'default' => 'php_mail',
'example_testkey' => 'test_mail_collector',
];
$this
->setUpMailManager($interface);
$this->renderer
->expects($this
->exactly(1))
->method('executeInRenderContext')
->willReturnCallback(function (RenderContext $render_context, $callback) {
$message = $callback();
$this
->assertEquals('example', $message['module']);
});
$this->mailManager
->mail('example', 'key', 'to@example.org', 'en');
}