Completed
Push — master ( c9535c...98c693 )
by Aimeos
10:51
created

Typo3Test::testRender()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 14
nc 1
nop 0
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