2 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
26 protected function setUp()
28 $this->subject = $this->getAccessibleMock(CurrencyViewHelper::class, array(
'renderChildren'));
30 $renderingContext = $this->getMock(RenderingContext::class);
31 $this->subject->_set(
'renderingContext', $renderingContext);
39 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(123.456));
40 $actualResult = $this->subject->render();
41 $this->assertEquals(
'123,46', $actualResult);
49 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(123));
50 $actualResult = $this->subject->render(
'foo');
51 $this->assertEquals(
'123,00 foo', $actualResult);
59 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(123));
60 $actualResult = $this->subject->render(
'foo',
',',
'.',
true);
61 $this->assertEquals(
'foo 123,00', $actualResult);
69 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(123));
70 $actualResult = $this->subject->render(
'foo',
',',
'.',
true,
false);
71 $this->assertEquals(
'foo123,00', $actualResult);
79 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(12345));
80 $actualResult = $this->subject->render(
'',
'|');
81 $this->assertEquals(
'12.345|00', $actualResult);
89 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(12345));
90 $actualResult = $this->subject->render(
'',
',',
'|');
91 $this->assertEquals(
'12|345,00', $actualResult);
99 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(null));
100 $actualResult = $this->subject->render();
101 $this->assertEquals(
'0,00', $actualResult);
109 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(
''));
110 $actualResult = $this->subject->render();
111 $this->assertEquals(
'0,00', $actualResult);
119 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(0));
120 $actualResult = $this->subject->render();
121 $this->assertEquals(
'0,00', $actualResult);
129 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(-123.456));
130 $actualResult = $this->subject->render();
131 $this->assertEquals(
'-123,46', $actualResult);
139 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(
'TYPO3'));
140 $actualResult = $this->subject->render();
141 $this->assertEquals(
'0,00', $actualResult);
149 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(
'12,34.00'));
150 $actualResult = $this->subject->render();
151 $this->assertEquals(
'12,00', $actualResult);
159 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(
'54321'));
160 $actualResult = $this->subject->render(
'',
',',
'.',
false,
true, 0);
161 $this->assertEquals(
'54.321', $actualResult);
169 $this->subject->expects($this->once())->method(
'renderChildren')->will($this->returnValue(
'54321'));
170 $actualResult = $this->subject->render(
'',
',',
'.',
false,
true, 3);
171 $this->assertEquals(
'54.321,000', $actualResult);