‪TYPO3CMS  11.5
NumberViewHelperTest.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 ‪NumberViewHelperTest extends FunctionalTestCase
24 {
28  protected ‪$initializeDatabase = false;
29 
30  public function ‪renderDataProvider(): array
31  {
32  return [
33  'formatNumberDefaultsToEnglishNotationWithTwoDecimals' => [
34  '<f:format.number>3.1415926535898</f:format.number>',
35  '3.14',
36  ],
37  'formatNumberWithDecimalPoint' => [
38  '<f:format.number decimalSeparator=",">3.1415926535898</f:format.number>',
39  '3,14',
40  ],
41  'formatNumberWithDecimals' => [
42  '<f:format.number decimals="4">3.1415926535898</f:format.number>',
43  '3.1416',
44  ],
45  'formatNumberWithThousandsSeparator' => [
46  '<f:format.number thousandsSeparator=",">3141.5926535898</f:format.number>',
47  '3,141.59',
48  ],
49  'formatNumberWithEmptyInput' => [
50  '<f:format.number></f:format.number>',
51  '0.00',
52  ],
53  ];
54  }
55 
60  public function ‪render(string $template, string $expected): void
61  {
62  $view = new ‪StandaloneView();
63  $view->setTemplateSource($template);
64  self::assertEquals($expected, $view->render());
65  }
66 }
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format
Definition: BytesViewHelperTest.php:18
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\NumberViewHelperTest\renderDataProvider
‪renderDataProvider()
Definition: NumberViewHelperTest.php:29
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\NumberViewHelperTest\$initializeDatabase
‪bool $initializeDatabase
Definition: NumberViewHelperTest.php:27
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:31
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\NumberViewHelperTest
Definition: NumberViewHelperTest.php:24
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\NumberViewHelperTest\render
‪render(string $template, string $expected)
Definition: NumberViewHelperTest.php:59