|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2017 |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace Aimeos\MW\View\Engine; |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
class Typo3Test extends \PHPUnit_Framework_TestCase |
|
12
|
|
|
{ |
|
13
|
|
|
private $object; |
|
14
|
|
|
private $mock; |
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
protected function setUp() |
|
18
|
|
|
{ |
|
19
|
|
|
if( !class_exists( '\TYPO3\CMS\Extbase\Object\ObjectManagerInterface' ) ) { |
|
20
|
|
|
$this->markTestSkipped( '\TYPO3\CMS\Extbase\Object\ObjectManagerInterface is not available' ); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
$this->mock = $this->getMockBuilder( '\TYPO3\CMS\Extbase\Object\ObjectManagerInterface' ) |
|
24
|
|
|
->setMethods( array( 'get' ) ) |
|
25
|
|
|
->disableOriginalConstructor() |
|
26
|
|
|
->getMock(); |
|
27
|
|
|
|
|
28
|
|
|
$this->object = new \Aimeos\MW\View\Engine\Typo3( $this->mock ); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
protected function tearDown() |
|
33
|
|
|
{ |
|
34
|
|
|
unset( $this->object, $this->mock ); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
public function testRender() |
|
39
|
|
|
{ |
|
40
|
|
|
$v = new \Aimeos\MW\View\Standard( array() ); |
|
41
|
|
|
|
|
42
|
|
|
$view = $this->getMockBuilder( 'TYPO3\\CMS\\Fluid\\View\\StandaloneView' ) |
|
43
|
|
|
->setMethods( array( 'assignMultiple', 'render', 'setTemplatePathAndFilename' ) ) |
|
44
|
|
|
->disableOriginalConstructor() |
|
45
|
|
|
->getMock(); |
|
46
|
|
|
|
|
47
|
|
|
$view->expects( $this->once() )->method( 'setTemplatePathAndFilename' ); |
|
48
|
|
|
$view->expects( $this->once() )->method( 'assignMultiple' ); |
|
49
|
|
|
$view->expects( $this->once() )->method( 'render' ) |
|
50
|
|
|
->will( $this->returnValue( 'test' ) ); |
|
51
|
|
|
|
|
52
|
|
|
$this->mock->expects( $this->once() )->method( 'get' ) |
|
53
|
|
|
->will( $this->returnValue( $view) ); |
|
54
|
|
|
|
|
55
|
|
|
$result = $this->object->render( $v, 'filepath', array( 'key' => 'value' ) ); |
|
56
|
|
|
$this->assertEquals( 'test', $result ); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|