Raised Extbase and Fluid to version 1.3.0
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Tests / Unit / ViewHelpers / ViewHelperBaseTestcase.php
1 <?php
2
3 /* *
4 * This script belongs to the FLOW3 package "Fluid". *
5 * *
6 * It is free software; you can redistribute it and/or modify it under *
7 * the terms of the GNU General Public License as published by the Free *
8 * Software Foundation, either version 3 of the License, or (at your *
9 * option) any later version. *
10 * *
11 * This script is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
13 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
14 * Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with the script. *
18 * If not, see http://www.gnu.org/licenses/gpl.html *
19 * *
20 * The TYPO3 project - inspiring people to share! *
21 * */
22
23 /**
24 */
25 abstract class Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase extends Tx_Extbase_Tests_Unit_BaseTestCase {
26
27 /**
28 * @var Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer
29 */
30 protected $viewHelperVariableContainer;
31
32 /**
33 * @var Tx_Fluid_Core_ViewHelper_TemplateVariableContainer
34 */
35 protected $templateVariableContainer;
36
37 /**
38 * @var Tx_Extbase_MVC_Web_Routing_UriBuilder
39 */
40 protected $uriBuilder;
41
42 /**
43 * @var Tx_Extbase_MVC_Controller_ControllerContext
44 */
45 protected $controllerContext;
46
47 /**
48 * @var Tx_Fluid_Core_ViewHelper_TagBuilder
49 */
50 protected $tagBuilder;
51
52 /**
53 * @var Tx_Fluid_Core_ViewHelper_Arguments
54 */
55 protected $arguments;
56
57 /**
58 * @var Tx_Extbase_MVC_Web_Request
59 */
60 protected $request;
61
62 /**
63 * @var Tx_Fluid_Core_Rendering_RenderingContext
64 */
65 protected $renderingContext;
66
67 /**
68 * @return void
69 * @author Sebastian Kurfürst <sebastian@typo3.org>
70 */
71 public function setUp() {
72 $this->viewHelperVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer');
73 $this->templateVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer');
74 $this->uriBuilder = $this->getMock('Tx_Extbase_MVC_Web_Routing_UriBuilder');
75 $this->uriBuilder->expects($this->any())->method('reset')->will($this->returnValue($this->uriBuilder));
76 $this->uriBuilder->expects($this->any())->method('setArguments')->will($this->returnValue($this->uriBuilder));
77 $this->uriBuilder->expects($this->any())->method('setSection')->will($this->returnValue($this->uriBuilder));
78 $this->uriBuilder->expects($this->any())->method('setFormat')->will($this->returnValue($this->uriBuilder));
79 $this->uriBuilder->expects($this->any())->method('setCreateAbsoluteUri')->will($this->returnValue($this->uriBuilder));
80 $this->uriBuilder->expects($this->any())->method('setAddQueryString')->will($this->returnValue($this->uriBuilder));
81 $this->uriBuilder->expects($this->any())->method('setArgumentsToBeExcludedFromQueryString')->will($this->returnValue($this->uriBuilder));
82 $this->uriBuilder->expects($this->any())->method('setLinkAccessRestrictedPages')->will($this->returnValue($this->uriBuilder));
83 $this->uriBuilder->expects($this->any())->method('setTargetPageUid')->will($this->returnValue($this->uriBuilder));
84 $this->uriBuilder->expects($this->any())->method('setTargetPageType')->will($this->returnValue($this->uriBuilder));
85 $this->uriBuilder->expects($this->any())->method('setNoCache')->will($this->returnValue($this->uriBuilder));
86 $this->uriBuilder->expects($this->any())->method('setUseCacheHash')->will($this->returnValue($this->uriBuilder));
87 $this->request = $this->getMock('Tx_Extbase_MVC_Web_Request');
88 $this->controllerContext = $this->getMock('Tx_Extbase_MVC_Controller_ControllerContext', array(), array(), '', FALSE);
89 $this->controllerContext->expects($this->any())->method('getUriBuilder')->will($this->returnValue($this->uriBuilder));
90 $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
91 $this->tagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder');
92 $this->arguments = $this->getMock('Tx_Fluid_Core_ViewHelper_Arguments', array(), array(), '', FALSE);
93 $this->renderingContext = $this->getMock('Tx_Fluid_Core_Rendering_RenderingContext');
94 }
95
96 /**
97 * @param Tx_Fluid_Core_ViewHelper_AbstractViewHelper $viewHelper
98 * @return void
99 * @author Sebastian Kurfürst <sebastian@typo3.org>
100 */
101 protected function injectDependenciesIntoViewHelper(Tx_Fluid_Core_ViewHelper_AbstractViewHelper $viewHelper) {
102 $viewHelper->setViewHelperVariableContainer($this->viewHelperVariableContainer);
103 $viewHelper->setTemplateVariableContainer($this->templateVariableContainer);
104 $viewHelper->setControllerContext($this->controllerContext);
105 $viewHelper->setRenderingContext($this->renderingContext);
106 $viewHelper->setArguments($this->arguments);
107 if ($viewHelper instanceof Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper) {
108 $viewHelper->_set('tag', $this->tagBuilder);
109 }
110 }
111 }
112 ?>