public function SwiftMailerAlterTest::testGeneratePlainTextVersion in Swift Mailer 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/SwiftMailerAlterTest.php \Drupal\Tests\swiftmailer\Functional\SwiftMailerAlterTest::testGeneratePlainTextVersion()
Create plain text version from body.
File
- tests/
src/ Functional/ SwiftMailerAlterTest.php, line 73
Class
- SwiftMailerAlterTest
- @group swiftmailer
Namespace
Drupal\Tests\swiftmailer\FunctionalCode
public function testGeneratePlainTextVersion() {
$plugin = Drupal\swiftmailer\Plugin\Mail\SwiftMailer::create(\Drupal::getContainer(), [], NULL, NULL);
$message = [
'module' => 'swiftmailer_test',
'key' => 'swiftmailer_test_1',
'headers' => [
'Content-Type' => SWIFTMAILER_FORMAT_HTML,
],
'params' => [
'convert' => TRUE,
],
'subject' => 'Subject',
'body' => [
Drupal\Core\Render\Markup::create('<strong>Hello World</strong>'),
],
];
$message = $plugin
->format($message);
$this
->assertContains('<strong>Hello World</strong>', (string) $message['body']);
$this
->assertContains('HELLO WORLD', $message['plain']);
}