TYPO3 CMS  TYPO3_7-6
RenderingContextTest.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the FLOW3 package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
18 {
24  protected $renderingContext;
25 
26  protected function setUp()
27  {
28  $this->renderingContext = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContext::class, ['dummy']);
29  }
30 
35  {
36  $templateVariableContainer = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer::class);
37  $this->renderingContext->injectTemplateVariableContainer($templateVariableContainer);
38  $this->assertSame($this->renderingContext->getTemplateVariableContainer(), $templateVariableContainer, 'Template Variable Container could not be read out again.');
39  }
40 
45  {
46  $controllerContext = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext::class, [], [], '', false);
47  $this->renderingContext->setControllerContext($controllerContext);
48  $this->assertSame($this->renderingContext->getControllerContext(), $controllerContext);
49  }
50 
55  {
56  $viewHelperVariableContainer = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperVariableContainer::class);
57  $this->renderingContext->_set('viewHelperVariableContainer', $viewHelperVariableContainer);
58  $this->assertSame($viewHelperVariableContainer, $this->renderingContext->getViewHelperVariableContainer());
59  }
60 }
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)