public function SwiftMailerTest::testMassageMessageBody in Swift Mailer 8
Same name in this branch
- 8 tests/src/Unit/Plugin/Mail/SwiftMailerTest.php \Drupal\Tests\swiftmailer\Unit\Plugin\Mail\SwiftMailerTest::testMassageMessageBody()
- 8 tests/src/Kernel/Plugin/Mail/SwiftMailerTest.php \Drupal\Tests\swiftmailer\Kernel\Plugin\Mail\SwiftMailerTest::testMassageMessageBody()
@covers ::massageMessageBody
File
- tests/
src/ Unit/ Plugin/ Mail/ SwiftMailerTest.php, line 21
Class
- SwiftMailerTest
- @coversDefaultClass \Drupal\swiftmailer\Plugin\Mail\SwiftMailer @group swiftmailer
Namespace
Drupal\Tests\swiftmailer\Unit\Plugin\MailCode
public function testMassageMessageBody() {
$method = new \ReflectionMethod(SwiftMailer::class, 'massageMessageBody');
$method
->setAccessible(TRUE);
$mailer = $this
->getMockBuilder(SwiftMailer::class)
->disableOriginalConstructor()
->getMock();
$body = [
'Hello World',
'Hello <strong>World</strong>',
new FormattableMarkup('Hello World #@number', [
'@number' => 2,
]),
Markup::create('Hello <strong>World</strong>'),
];
$result = [
'Hello World',
'Hello <strong>World</strong>',
'Hello World #2',
'Hello <strong>World</strong>',
];
$message = $method
->invoke($mailer, [
'body' => $body,
]);
$this
->assertSame(implode(PHP_EOL, $result), (string) $message['body']);
}