Passed
Push — master ( fa79ba...4fcbee )
by Aimeos
08:39 queued 05:58
created

T3View::setLayoutRootPaths()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017-2022
6
 */
7
8
namespace Aimeos\Base\View\Engine;
9
10
11
class Typo3Test extends \PHPUnit\Framework\TestCase
12
{
13
	public function testRender()
14
	{
15
		if( !class_exists( '\TYPO3\CMS\Extbase\Object\ObjectManagerInterface' ) ) {
16
			$this->markTestSkipped( 'TYPO3 ObjectManager not available' );
17
		}
18
19
		$mock = $this->getMockBuilder( '\TYPO3\CMS\Extbase\Object\ObjectManagerInterface' )
20
			->setMethods( array( 'get' ) )
21
			->disableOriginalConstructor()
22
			->getMock();
23
24
		$config = $this->getMockBuilder( '\TYPO3\CMS\Extbase\Configuration\ConfigurationManager' )
25
			->setMethods( array( 'getConfiguration' ) )
26
			->disableOriginalConstructor()
27
			->getMock();
28
29
		$view = $this->getMockBuilder( 'T3View' )
30
			->setMethods( array( 'assign', 'assignMultiple', 'render', 'setTemplatePathAndFilename', 'setPartialRootPaths', 'setLayoutRootPaths' ) )
31
			->disableOriginalConstructor()
32
			->getMock();
33
34
		$conf = ['view' => ['partialRootPaths' => '', 'layoutRootPaths' => '']];
35
		$config->expects( $this->once() )->method( 'getConfiguration' )->will( $this->returnValue( $conf ) );
36
		$mock->expects( $this->exactly( 2 ) )->method( 'get' )->will( $this->onConsecutiveCalls( $config, $view ) );
37
38
		$view->expects( $this->once() )->method( 'setTemplatePathAndFilename' );
39
		$view->expects( $this->once() )->method( 'assignMultiple' );
40
		$view->expects( $this->once() )->method( 'assign' );
41
		$view->expects( $this->once() )->method( 'setPartialRootPaths' );
42
		$view->expects( $this->once() )->method( 'setLayoutRootPaths' );
43
		$view->expects( $this->once() )->method( 'render' )->will( $this->returnValue( 'test' ) );
44
45
		$v = new \Aimeos\Base\View\Standard( [] );
46
		$object = new \Aimeos\Base\View\Engine\Typo3( $mock );
47
48
		$this->assertEquals( 'test', $object->render( $v, 'filepath', array( 'key' => 'value' ) ) );
49
	}
50
}
51
52
53
54
class T3View
55
{
56
	public function setTemplatePathAndFilename( $filepath )
57
	{
58
	}
59
60
	public function setPartialRootPaths( array $partialRootPaths )
61
	{
62
	}
63
64
	public function setLayoutRootPaths( array $setLayoutRootPaths )
65
	{
66
	}
67
68
	public function assignMultiple( array $values )
69
	{
70
	}
71
72
	public function assign( $key, $value )
73
	{
74
	}
75
76
	public function render()
77
	{
78
	}
79
}
80