18 use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
30 protected function setUp()
34 $this->injectDependenciesIntoViewHelper($this->viewHelper);
43 'rounds float correctly' => [
48 'expected' =>
'123,46',
54 'currencySign' =>
'foo'
56 'expected' =>
'123,00 foo',
58 'prepended currency sign' => [
62 'currencySign' =>
'foo',
63 'decimalSeparator' =>
',',
64 'thousandsSeparator' =>
'.',
65 'prependCurrency' => true
67 'expected' =>
'foo 123,00',
69 'respects currency separator' =>[
73 'currencySign' =>
'foo',
74 'decimalSeparator' =>
',',
75 'thousandsSeparator' =>
'.',
76 'prependCurrency' =>
true,
77 'separateCurrency' => false
79 'expected' =>
'foo123,00',
81 'respects decimal separator' => [
86 'decimalSeparator' =>
'|'
88 'expected' =>
'12.345|00',
90 'respects thousands separator' => [
95 'decimalSeparator' =>
',',
96 'thousandsSeparator' =>
'|'
98 'expected' =>
'12|345,00',
105 'expected' =>
'0,00',
112 'expected' =>
'0,00',
119 'expected' =>
'0,00',
121 'negative amounts' => [
122 'value' =>
'-123.456',
126 'expected' =>
'-123,46',
128 'strings to zero value float' => [
133 'expected' =>
'0,00',
135 'comma values to value before comma' => [
136 'value' =>
'12,34.00',
140 'expected' =>
'12,00',
142 'without decimals' => [
146 'currencySign' =>
'',
147 'decimalSeparator' =>
',',
148 'thousandsSeparator' =>
'.',
149 'prependCurrency' =>
false,
150 'separateCurrency' =>
true,
153 'expected' =>
'54.321',
155 'three decimals' => [
159 'currencySign' =>
'',
160 'decimalSeparator' =>
',',
161 'thousandsSeparator' =>
'.',
162 'prependCurrency' =>
false,
163 'separateCurrency' =>
true,
166 'expected' =>
'54.321,000',
169 'value' =>
'54321.00',
172 'decimalSeparator' =>
',',
173 'thousandsSeparator' =>
'.',
174 'prependCurrency' =>
false,
175 'separateCurrency' =>
true,
178 'expected' =>
'54.321,—',
181 'value' =>
'54321.45',
184 'decimalSeparator' =>
',',
185 'thousandsSeparator' =>
'.',
186 'prependCurrency' =>
false,
187 'separateCurrency' =>
true,
190 'expected' =>
'54.321,45',
204 $this->viewHelper->setRenderChildrenClosure(
205 function () use ($value) {
209 $this->setArgumentsUnderTest($this->viewHelper, $arguments);
210 $actualResult = $this->viewHelper->initializeArgumentsAndRender();
211 $this->assertEquals($expected, $actualResult);