TYPO3 CMS  TYPO3_6-2
PrintfViewHelperTest.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU General Public License, either version 3 of the *
9  * License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
18 
22  public function viewHelperCanUseArrayAsArgument() {
23  $viewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\PrintfViewHelper', array('renderChildren'));
24  $viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('%04d-%02d-%02d'));
25  $actualResult = $viewHelper->render(array('year' => 2009, 'month' => 4, 'day' => 5));
26  $this->assertEquals('2009-04-05', $actualResult);
27  }
28 
33  $viewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\PrintfViewHelper', array('renderChildren'));
34  $viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('%2$s %1$d %3$s %2$s'));
35  $actualResult = $viewHelper->render(array(123, 'foo', 'bar'));
36  $this->assertEquals('foo 123 bar foo', $actualResult);
37  }
38 }