‪TYPO3CMS  11.5
HtmlViewHelperTest.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 
22 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
23 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
24 
25 class ‪HtmlViewHelperTest extends FunctionalTestCase
26 {
28 
32  protected const ‪LANGUAGE_PRESETS = [
33  'EN' => ['id' => 0, 'title' => 'English', 'locale' => 'en_US.UTF8'],
34  ];
35 
36  public function ‪contentIsRenderedDataProvider(): array
37  {
38  return [
39  'explicitly empty parseFunc path' => [
40  '<f:format.html parseFuncTSPath="">TYPO3 is a cool CMS</f:format.html>',
41  'TYPO3 is a cool CMS',
42  ],
43  'non-existing parseFunc path' => [
44  '<f:format.html parseFuncTSPath="null.this.does.not.exist">TYPO3 is a cool CMS</f:format.html>',
45  'TYPO3 is a cool CMS',
46  ],
47  ];
48  }
49 
54  public function ‪contentIsRendered(string $fluidTemplateSource, string $expected): void
55  {
56  $this->importCSVDataSet(__DIR__ . '/../../Fixtures/pages.csv');
58  'test',
59  $this->‪buildSiteConfiguration(1, '/'),
60  [
61  $this->‪buildDefaultLanguageConfiguration('EN', '/en/'),
62  ]
63  );
64  $this->‪createTypoScriptTemplate($fluidTemplateSource);
65 
66  $response = $this->executeFrontendSubRequest(
67  (new InternalRequest())->withPageId(1)
68  );
69  self::assertStringContainsString($expected, (string)$response->getBody());
70  }
71 
72  private function ‪createTypoScriptTemplate(string $fluidTemplateSource): void
73  {
74  (new ‪ConnectionPool())->getConnectionForTable('sys_template')
75  ->insert(
76  'sys_template',
77  [
78  'pid' => 1,
79  'root' => 1,
80  'clear' => 1,
81  'config' => <<<EOT
82 constants.PROJECT = ‪TYPO3
83 constants.FOO = BAR
84 lib.parseFunc_RTE {
85  htmlSanitize = 1
86  constants = 1
87 }
88 lib.foo {
89  htmlSanitize = 1
90  constants = 1
91 }
92 lib.inventor {
93  htmlSanitize = 1
94  plainTextStdWrap.noTrimWrap = || |
95  plainTextStdWrap.dataWrap = |{CURRENT:1}
96 }
97 lib.record {
98  htmlSanitize = 1
99  plainTextStdWrap.noTrimWrap = || |
100  plainTextStdWrap.dataWrap = |{FIELD:title}
101 }
102 lib.news {
103  htmlSanitize = 1
104  constants = 1
105  plainTextStdWrap.noTrimWrap = || |
106  plainTextStdWrap.dataWrap = |{CURRENT:1}
107 }
108 page = PAGE
109 page.10 = FLUIDTEMPLATE
110 page.10 {
111  template = TEXT
112  template.value = $fluidTemplateSource
113 }
114 EOT
115  ]
116  );
117  }
118 }
‪TYPO3\CMS\Fluid\Tests\FunctionalDeprecated\ViewHelpers\Format\HtmlViewHelperTest
Definition: HtmlViewHelperTest.php:26
‪TYPO3\CMS\Fluid\Tests\FunctionalDeprecated\ViewHelpers\Format\HtmlViewHelperTest\contentIsRendered
‪contentIsRendered(string $fluidTemplateSource, string $expected)
Definition: HtmlViewHelperTest.php:53
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait
Definition: SiteBasedTestTrait.php:36
‪TYPO3
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:58
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration
‪array buildDefaultLanguageConfiguration(string $identifier, string $base)
Definition: SiteBasedTestTrait.php:126
‪TYPO3\CMS\Fluid\Tests\FunctionalDeprecated\ViewHelpers\Format\HtmlViewHelperTest\createTypoScriptTemplate
‪createTypoScriptTemplate(string $fluidTemplateSource)
Definition: HtmlViewHelperTest.php:71
‪TYPO3\CMS\Fluid\Tests\FunctionalDeprecated\ViewHelpers\Format\HtmlViewHelperTest\contentIsRenderedDataProvider
‪contentIsRenderedDataProvider()
Definition: HtmlViewHelperTest.php:35
‪TYPO3\CMS\Fluid\Tests\FunctionalDeprecated\ViewHelpers\Format\HtmlViewHelperTest\LANGUAGE_PRESETS
‪const LANGUAGE_PRESETS
Definition: HtmlViewHelperTest.php:31
‪TYPO3\CMS\Fluid\Tests\FunctionalDeprecated\ViewHelpers\Format
Definition: HtmlViewHelperTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪array buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:111
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46