18 use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
30 protected function setUp()
34 $this->injectDependenciesIntoViewHelper($this->viewHelper);
48 'decimalSeparator' =>
null,
49 'thousandsSeparator' =>
null,
55 'decimalSeparator' =>
null,
56 'thousandsSeparator' =>
null,
57 'expected' =>
'0.00 B'
62 'decimalSeparator' =>
',',
63 'thousandsSeparator' =>
null,
64 'expected' =>
'0,00 B'
70 'decimalSeparator' =>
null,
71 'thousandsSeparator' =>
null,
77 'decimalSeparator' =>
null,
78 'thousandsSeparator' =>
null,
79 'expected' =>
'42.0 KB'
84 'decimalSeparator' =>
null,
85 'thousandsSeparator' =>
null,
86 'expected' =>
'1.0 KB'
91 'decimalSeparator' =>
null,
92 'thousandsSeparator' =>
null,
93 'expected' =>
'1,023.00 B'
96 'value' => 1073741823,
98 'decimalSeparator' =>
null,
99 'thousandsSeparator' =>
'.',
100 'expected' =>
'1.024.0 MB'
103 'value' => pow(1024, 5),
105 'decimalSeparator' =>
null,
106 'thousandsSeparator' =>
null,
107 'expected' =>
'1.0 PB'
110 'value' => pow(1024, 8),
112 'decimalSeparator' =>
null,
113 'thousandsSeparator' =>
null,
114 'expected' =>
'1.0 YB'
128 public function renderConvertsAValue($value, $decimals, $decimalSeparator, $thousandsSeparator, $expected)
130 $this->setArgumentsUnderTest(
134 'decimals' => $decimals,
135 'decimalSeparator' => $decimalSeparator,
136 'thousandsSeparator' => $thousandsSeparator,
137 'units' =>
'B,KB,MB,GB,TB,PB,EB,ZB,YB',
140 $actualResult = $this->viewHelper->initializeArgumentsAndRender();
141 $this->assertEquals($expected, $actualResult);
149 $this->viewHelper->setRenderChildrenClosure(
154 $this->setArgumentsUnderTest(
157 'units' =>
'B,KB,MB,GB,TB,PB,EB,ZB,YB',
160 $actualResult = $this->viewHelper->initializeArgumentsAndRender();
161 $this->assertEquals(
'12 KB', $actualResult);