2 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
32 $reflectionClass = new \ReflectionClass(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::class);
33 $property = $reflectionClass->getProperty(
'configurationManager');
34 $property->setAccessible(
true);
35 $property->setValue($this->getMock(ConfigurationManagerInterface::class));
37 $this->viewHelper = $this->getMock(\TYPO3\CMS\
Fluid\ViewHelpers\Format\BytesViewHelper::class, array(
'renderChildren'));
39 $this->viewHelper->initializeArguments();
53 'decimalSeparator' => null,
54 'thousandsSeparator' => null,
60 'decimalSeparator' => null,
61 'thousandsSeparator' => null,
62 'expected' =>
'0.00 B'
67 'decimalSeparator' =>
',',
68 'thousandsSeparator' => null,
69 'expected' =>
'0,00 B'
75 'decimalSeparator' => null,
76 'thousandsSeparator' => null,
82 'decimalSeparator' => null,
83 'thousandsSeparator' => null,
84 'expected' =>
'42.0 KB'
89 'decimalSeparator' => null,
90 'thousandsSeparator' => null,
91 'expected' =>
'1.0 KB'
96 'decimalSeparator' => null,
97 'thousandsSeparator' => null,
98 'expected' =>
'1,023.00 B'
101 'value' => 1073741823,
103 'decimalSeparator' => null,
104 'thousandsSeparator' =>
'.',
105 'expected' =>
'1.024.0 MB'
108 'value' => pow(1024, 5),
110 'decimalSeparator' => null,
111 'thousandsSeparator' => null,
112 'expected' =>
'1.0 PB'
115 'value' => pow(1024, 8),
117 'decimalSeparator' => null,
118 'thousandsSeparator' => null,
119 'expected' =>
'1.0 YB'
135 $actualResult = $this->viewHelper->render($value, $decimals, $decimalSeparator, $thousandsSeparator);
136 $this->assertEquals($expected, $actualResult);
144 $this->viewHelper->expects($this->once())->method(
'renderChildren')->will($this->returnValue(12345));
145 $actualResult = $this->viewHelper->render();
146 $this->assertEquals(
'12 KB', $actualResult);