class SwiftMailerTest in Swift Mailer 8
Same name in this branch
- 8 tests/src/Unit/Plugin/Mail/SwiftMailerTest.php \Drupal\Tests\swiftmailer\Unit\Plugin\Mail\SwiftMailerTest
- 8 tests/src/Kernel/Plugin/Mail/SwiftMailerTest.php \Drupal\Tests\swiftmailer\Kernel\Plugin\Mail\SwiftMailerTest
@coversDefaultClass \Drupal\swiftmailer\Plugin\Mail\SwiftMailer @group swiftmailer
Hierarchy
- class \Drupal\Tests\swiftmailer\Unit\Plugin\Mail\SwiftMailerTest extends \PHPUnit\Framework\TestCase
Expanded class hierarchy of SwiftMailerTest
File
- tests/
src/ Unit/ Plugin/ Mail/ SwiftMailerTest.php, line 16
Namespace
Drupal\Tests\swiftmailer\Unit\Plugin\MailView source
class SwiftMailerTest extends TestCase {
/**
* @covers ::massageMessageBody
*/
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']);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SwiftMailerTest:: |
public | function | @covers ::massageMessageBody |