‪TYPO3CMS  11.5
HtmlentitiesDecodeViewHelperTest.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 ‪HtmlentitiesDecodeViewHelperTest extends FunctionalTestCase
24 {
28  protected ‪$initializeDatabase = false;
29 
33  public function ‪renderUsesValueAsSourceIfSpecified(): void
34  {
35  $view = new ‪StandaloneView();
36  $view->setTemplateSource('<f:format.htmlentitiesDecode value="Some string" />');
37  self::assertEquals('Some string', $view->render());
38  }
39 
43  public function ‪renderUsesChildnodesAsSourceIfSpecified(): void
44  {
45  $view = new ‪StandaloneView();
46  $view->setTemplateSource('<f:format.htmlentitiesDecode>Some string</f:format.htmlentitiesDecode>');
47  self::assertEquals('Some string', $view->render());
48  }
49 
54  {
55  $source = 'This is a sample text without special characters. <> &©"\'';
56  $view = new ‪StandaloneView();
57  $view->setTemplateSource('<f:format.htmlentitiesDecode>' . $source . '</f:format.htmlentitiesDecode>');
58  self::assertEquals($source, $view->render());
59  }
60 
64  public function ‪renderDecodesSimpleString(): void
65  {
66  $source = 'Some special characters: &amp; &quot; \' &lt; &gt; *';
67  $expectedResult = 'Some special characters: & " \' < > *';
68  $view = new ‪StandaloneView();
69  $view->setTemplateSource('<f:format.htmlentitiesDecode>' . $source . '</f:format.htmlentitiesDecode>');
70  self::assertEquals($expectedResult, $view->render());
71  }
72 
76  public function ‪renderRespectsKeepQuoteArgument(): void
77  {
78  $source = 'Some special characters: &amp; &quot; \' &lt; &gt; *';
79  $expectedResult = 'Some special characters: & &quot; \' < > *';
80  $view = new ‪StandaloneView();
81  $view->setTemplateSource('<f:format.htmlentitiesDecode keepQuotes="true">' . $source . '</f:format.htmlentitiesDecode>');
82  self::assertEquals($expectedResult, $view->render());
83  }
84 
88  public function ‪renderRespectsEncodingArgument(): void
89  {
90  $source = 'Some special characters: &amp; &quot; \' &lt; &gt; *';
91  $expectedResult = 'Some special characters: & " \' < > *';
92  $view = new ‪StandaloneView();
93  $view->setTemplateSource('<f:format.htmlentitiesDecode encoding="ISO-8859-1">' . $source . '</f:format.htmlentitiesDecode>');
94  self::assertEquals($expectedResult, $view->render());
95  }
96 }
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlentitiesDecodeViewHelperTest\renderRespectsEncodingArgument
‪renderRespectsEncodingArgument()
Definition: HtmlentitiesDecodeViewHelperTest.php:87
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlentitiesDecodeViewHelperTest\renderDecodesSimpleString
‪renderDecodesSimpleString()
Definition: HtmlentitiesDecodeViewHelperTest.php:63
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlentitiesDecodeViewHelperTest
Definition: HtmlentitiesDecodeViewHelperTest.php:24
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlentitiesDecodeViewHelperTest\renderDoesNotModifyValueIfItDoesNotContainSpecialCharacters
‪renderDoesNotModifyValueIfItDoesNotContainSpecialCharacters()
Definition: HtmlentitiesDecodeViewHelperTest.php:52
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlentitiesDecodeViewHelperTest\renderUsesChildnodesAsSourceIfSpecified
‪renderUsesChildnodesAsSourceIfSpecified()
Definition: HtmlentitiesDecodeViewHelperTest.php:42
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format
Definition: BytesViewHelperTest.php:18
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlentitiesDecodeViewHelperTest\$initializeDatabase
‪bool $initializeDatabase
Definition: HtmlentitiesDecodeViewHelperTest.php:27
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlentitiesDecodeViewHelperTest\renderUsesValueAsSourceIfSpecified
‪renderUsesValueAsSourceIfSpecified()
Definition: HtmlentitiesDecodeViewHelperTest.php:32
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:31
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlentitiesDecodeViewHelperTest\renderRespectsKeepQuoteArgument
‪renderRespectsKeepQuoteArgument()
Definition: HtmlentitiesDecodeViewHelperTest.php:75