602069c1694ef7b8145934bcac0010cf49bcb42e
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Tests / Unit / View / AbstractTemplateViewTest.php
1 <?php
2 namespace TYPO3\CMS\Fluid\Tests\Unit\View;
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 */
16 use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
17 use TYPO3\CMS\Fluid\View\AbstractTemplateView;
18 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer;
21
22 /**
23 * Test case
24 */
25 class AbstractTemplateViewTest extends UnitTestCase
26 {
27 /**
28 * @var AbstractTemplateView|AccessibleObjectInterface
29 */
30 protected $view;
31
32 /**
33 * @var RenderingContext|\PHPUnit_Framework_MockObject_MockObject
34 */
35 protected $renderingContext;
36
37 /**
38 * @var ViewHelperVariableContainer|\PHPUnit_Framework_MockObject_MockObject
39 */
40 protected $viewHelperVariableContainer;
41
42 /**
43 * Sets up this test case
44 */
45 protected function setUp()
46 {
47 $this->viewHelperVariableContainer = $this->getMockBuilder(ViewHelperVariableContainer::class)
48 ->setMethods(['setView'])
49 ->getMock();
50 $this->renderingContext = $this->getMockBuilder(\TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture::class)
51 ->setMethods(['getViewHelperVariableContainer'])
52 ->getMock();
53 $this->renderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->viewHelperVariableContainer));
54 $this->view = $this->getAccessibleMock(AbstractTemplateView::class, ['dummy'], [], '', false);
55 $this->view->setRenderingContext($this->renderingContext);
56 }
57
58 /**
59 * @test
60 */
61 public function viewIsPlacedInViewHelperVariableContainer()
62 {
63 $this->viewHelperVariableContainer->expects($this->once())->method('setView')->with($this->view);
64 $this->view->setRenderingContext($this->renderingContext);
65 }
66 }