You are here

public function SwiftMailerTest::bodyDataProvider in Swift Mailer 8

Data provider of body data with markup and without HTML markup.

File

tests/src/Kernel/Plugin/Mail/SwiftMailerTest.php, line 59

Class

SwiftMailerTest
@coversDefaultClass \Drupal\swiftmailer\Plugin\Mail\SwiftMailer @group swiftmailer

Namespace

Drupal\Tests\swiftmailer\Kernel\Plugin\Mail

Code

public function bodyDataProvider() {
  return [
    'with html' => [
      'message' => [
        'body' => [
          Markup::create('<p>Lorem ipsum dolor sit amet</p>'),
          Markup::create('<p>consetetur sadipscing elitr</p>'),
          Markup::create('<p>sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat</p>'),
          Markup::create('<p>sed diam voluptua.</p>'),
        ],
      ],
      'expected' => "<p>Lorem ipsum dolor sit amet</p>\n<p>consetetur sadipscing elitr</p>\n<p>sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat</p>\n<p>sed diam voluptua.</p>",
    ],
    'no html' => [
      'message' => [
        'body' => [
          "Lorem ipsum dolor sit amet\nconsetetur sadipscing elitr\nsed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat\nsed diam voluptua.",
        ],
      ],
      'expected' => "<p>Lorem ipsum dolor sit amet<br />\nconsetetur sadipscing elitr<br />\nsed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat<br />\nsed diam voluptua.</p>\n",
    ],
  ];
}