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