TYPO3  7.6
Functional/ContentObject/FluidTemplateContentObjectTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Frontend\Tests\Functional\ContentObject;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
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 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
18 
22 class FluidTemplateContentObjectTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
23 {
24  protected $coreExtensionsToLoad = array('fluid');
25 
29  public function renderWorksWithNestedFluidtemplate()
30  {
32  $tsfe = $this->getMock(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, array(), array(), '', false);
33  $GLOBALS['TSFE'] = $tsfe;
34 
35  $configuration = array(
36  '10' => 'FLUIDTEMPLATE',
37  '10.' => array(
38  'template' => 'TEXT',
39  'template.' => array(
40  'value' => 'A{anotherFluidTemplate}C'
41  ),
42  'variables.' => array(
43  'anotherFluidTemplate' => 'FLUIDTEMPLATE',
44  'anotherFluidTemplate.' => array(
45  'template' => 'TEXT',
46  'template.' => array(
47  'value' => 'B',
48  ),
49  ),
50  ),
51  ),
52  );
53  $expectedResult = 'ABC';
54 
55  $contentObjectRenderer = new \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
56  $contentObjectRenderer->setContentObjectClassMap(array(
57  'FLUIDTEMPLATE' => FluidTemplateContentObject::class,
58  'TEXT' => TextContentObject::class,
59  ));
60  $fluidTemplateContentObject = new \TYPO3\CMS\Frontend\ContentObject\ContentObjectArrayContentObject(
61  $contentObjectRenderer
62  );
63  $result = $fluidTemplateContentObject->render($configuration);
64 
65  $this->assertEquals($expectedResult, $result);
66  }
67 }