[~FEATURE] Fluid (ViewHelpers): Adjusted AbstractFormViewHelper to be able to namespa...
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Tests / 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 * @version $Id: ViewHelperBaseTestcase.php 2914 2009-07-28 18:26:38Z bwaidelich $
25 */
26 abstract class Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase extends Tx_Extbase_Base_testcase {
27
28 /**
29 * @var Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer
30 */
31 protected $viewHelperVariableContainer;
32
33 /**
34 * @var Tx_Fluid_Core_ViewHelper_TemplateVariableContainer
35 */
36 protected $templateVariableContainer;
37
38 /**
39 * @var \Tx_Extbase_MVC_Web_Routing_URIBuilder
40 */
41 protected $uriBuilder;
42
43 /**
44 * @var \Tx_Extbase_MVC_Controller_ControllerContext
45 */
46 protected $controllerContext;
47
48 /**
49 * @var Tx_Fluid_Core_ViewHelper_TagBuilder
50 */
51 protected $tagBuilder;
52
53 /**
54 * @var Tx_Fluid_Core_ViewHelper_Arguments
55 */
56 protected $arguments;
57
58 /**
59 * @var \Tx_Extbase_MVC_Request
60 */
61 protected $request;
62
63 /**
64 * @return void
65 * @author Sebastian Kurfürst <sebastian@typo3.org>
66 */
67 public function setUp() {
68 $this->viewHelperVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer');
69 $this->templateVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer');
70 $this->uriBuilder = $this->getMock('Tx_Extbase_MVC_Web_Routing_URIBuilder');
71 $this->request = $this->getMock('Tx_Extbase_MVC_Request');
72 $this->controllerContext = $this->getMock('Tx_Extbase_MVC_Controller_ControllerContext');
73 $this->controllerContext->expects($this->any())->method('getURIBuilder')->will($this->returnValue($this->uriBuilder));
74 $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
75 $this->tagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder');
76 $this->arguments = $this->getMock('Tx_Fluid_Core_ViewHelper_Arguments', array(), array(), '', FALSE);
77 }
78
79 /**
80 * @param Tx_Fluid_Core_ViewHelper_AbstractViewHelper $viewHelper
81 * @return void
82 * @author Sebastian Kurfürst <sebastian@typo3.org>
83 */
84 protected function injectDependenciesIntoViewHelper(Tx_Fluid_Core_ViewHelper_AbstractViewHelper $viewHelper) {
85 $viewHelper->setViewHelperVariableContainer($this->viewHelperVariableContainer);
86 $viewHelper->setTemplateVariableContainer($this->templateVariableContainer);
87 $viewHelper->setControllerContext($this->controllerContext);
88 $viewHelper->setArguments($this->arguments);
89 if ($viewHelper instanceof Tx_Fluid_Core_ViewHelper_TagBasedViewHelper) {
90 $viewHelper->injectTagBuilder($this->tagBuilder);
91 }
92 }
93 }
94 ?>