|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2017-2020 |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace Aimeos\MW\View\Engine; |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'T3Object'; |
|
12
|
|
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'T3View'; |
|
13
|
|
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'T3Configuration'; |
|
14
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
class Typo3Test extends \PHPUnit\Framework\TestCase |
|
17
|
|
|
{ |
|
18
|
|
|
public function testRender() |
|
19
|
|
|
{ |
|
20
|
|
|
$mock = $this->getMockBuilder( '\TYPO3\CMS\Extbase\Object\ObjectManagerInterface' ) |
|
21
|
|
|
->setMethods( array( 'get' ) ) |
|
22
|
|
|
->disableOriginalConstructor() |
|
23
|
|
|
->getMock(); |
|
24
|
|
|
|
|
25
|
|
|
$config = $this->getMockBuilder( '\TYPO3\CMS\Extbase\Configuration\ConfigurationManager' ) |
|
26
|
|
|
->setMethods( array( 'getConfiguration' ) ) |
|
27
|
|
|
->disableOriginalConstructor() |
|
28
|
|
|
->getMock(); |
|
29
|
|
|
|
|
30
|
|
|
$view = $this->getMockBuilder( 'TYPO3\\CMS\\Fluid\\View\\T3View' ) |
|
31
|
|
|
->setMethods( array( 'assign', 'assignMultiple', 'render', 'setTemplatePathAndFilename', 'setPartialRootPaths', 'setLayoutRootPaths' ) ) |
|
32
|
|
|
->disableOriginalConstructor() |
|
33
|
|
|
->getMock(); |
|
34
|
|
|
|
|
35
|
|
|
$conf = ['view' => ['partialRootPaths' => '', 'layoutRootPaths' => '']]; |
|
36
|
|
|
$config->expects( $this->once() )->method( 'getConfiguration' )->will( $this->returnValue( $conf ) ); |
|
37
|
|
|
$mock->expects( $this->exactly( 2 ) )->method( 'get' )->will( $this->onConsecutiveCalls( $config, $view ) ); |
|
38
|
|
|
|
|
39
|
|
|
$view->expects( $this->once() )->method( 'setTemplatePathAndFilename' ); |
|
40
|
|
|
$view->expects( $this->once() )->method( 'assignMultiple' ); |
|
41
|
|
|
$view->expects( $this->once() )->method( 'assign' ); |
|
42
|
|
|
$view->expects( $this->once() )->method( 'setPartialRootPaths' ); |
|
43
|
|
|
$view->expects( $this->once() )->method( 'setLayoutRootPaths' ); |
|
44
|
|
|
$view->expects( $this->once() )->method( 'render' )->will( $this->returnValue( 'test' ) ); |
|
45
|
|
|
|
|
46
|
|
|
$v = new \Aimeos\MW\View\Standard( [] ); |
|
47
|
|
|
$object = new \Aimeos\MW\View\Engine\Typo3( $mock ); |
|
48
|
|
|
|
|
49
|
|
|
$this->assertEquals( 'test', $object->render( $v, 'filepath', array( 'key' => 'value' ) ) ); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|