‪TYPO3CMS  10.4
FluidEmailTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
22 
23 class ‪FluidEmailTest extends FunctionalTestCase
24 {
29  {
30  $subject = new ‪FluidEmail();
31  $subject
33  ->setTemplate('Default')
34  ->from('benniYYYY@typo3.org')
35  ->assign('content', 'Plain content from Functional test')
36  ->to('some-recipient@example.com');
37  $result = $subject->getBody();
38  self::assertEquals('plain', $result->getMediaSubtype());
39  self::assertStringContainsString('Plain content from Functional test', $result->bodyToString());
40  self::assertEmpty($subject->getHtmlBody());
41  self::assertNotEmpty($subject->getTextBody());
42  }
43 
48  {
49  $subject = new ‪FluidEmail();
50  $subject
52  ->setTemplate('Default')
53  ->from('benniYYYY@typo3.org')
54  ->assign('content', 'HTML content <strong>from</strong> Functional test')
55  ->to('some-recipient@example.com');
56  $result = $subject->getBody();
57  self::assertEquals('html', $result->getMediaSubtype());
58  self::assertStringContainsString('&lt;strong&gt;from&lt;/strong&gt;', $result->bodyToString());
59  self::assertNotEmpty($subject->getHtmlBody());
60  self::assertEmpty($subject->getTextBody());
61  }
62 
67  {
68  $subject = new ‪FluidEmail();
69  $subject
71  ->setTemplate('Default')
72  ->from('benniYYYY@typo3.org')
73  ->assign('content', 'Plain content <strong>from</strong> Functional test')
74  ->to('some-recipient@example.com');
75  $result = $subject->getBody();
76  self::assertEquals('alternative', $result->getMediaSubtype());
77  self::assertStringContainsString('&lt;strong&gt;from&lt;/strong&gt;', $result->bodyToString());
78  self::assertNotEmpty($subject->getHtmlBody());
79  self::assertNotEmpty($subject->getTextBody());
80  }
81 }
‪TYPO3\CMS\Core\Mail\FluidEmail\FORMAT_BOTH
‪const FORMAT_BOTH
Definition: FluidEmail.php:38
‪TYPO3\CMS\Core\Tests\Functional\Mail\FluidEmailTest\settingFormatWithHtmlOnlyGeneratesHtmlEmail
‪settingFormatWithHtmlOnlyGeneratesHtmlEmail()
Definition: FluidEmailTest.php:47
‪TYPO3\CMS\Core\Mail\FluidEmail\FORMAT_HTML
‪const FORMAT_HTML
Definition: FluidEmail.php:36
‪TYPO3\CMS\Core\Tests\Functional\Mail
Definition: FluidEmailTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\Mail\FluidEmailTest
Definition: FluidEmailTest.php:24
‪TYPO3\CMS\Core\Tests\Functional\Mail\FluidEmailTest\settingFormatWithTextAndHtmlGeneratesTwoBodies
‪settingFormatWithTextAndHtmlGeneratesTwoBodies()
Definition: FluidEmailTest.php:66
‪TYPO3\CMS\Core\Mail\FluidEmail
Definition: FluidEmail.php:35
‪TYPO3\CMS\Core\Mail\FluidEmail\FORMAT_PLAIN
‪const FORMAT_PLAIN
Definition: FluidEmail.php:37
‪TYPO3\CMS\Core\Tests\Functional\Mail\FluidEmailTest\settingFormatWithTextOnlyGeneratesTextEmail
‪settingFormatWithTextOnlyGeneratesTextEmail()
Definition: FluidEmailTest.php:28