TYPO3 API  SVNRelease
ViewHelperBaseTestcase.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*                                                                        *
00004  * This script belongs to the FLOW3 package "Fluid".                      *
00005  *                                                                        *
00006  * It is free software; you can redistribute it and/or modify it under    *
00007  * the terms of the GNU General Public License as published by the Free   *
00008  * Software Foundation, either version 3 of the License, or (at your      *
00009  * option) any later version.                                             *
00010  *                                                                        *
00011  * This script is distributed in the hope that it will be useful, but     *
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
00013  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General      *
00014  * Public License for more details.                                       *
00015  *                                                                        *
00016  * You should have received a copy of the GNU General Public License      *
00017  * along with the script.                                                 *
00018  * If not, see http://www.gnu.org/licenses/gpl.html                       *
00019  *                                                                        *
00020  * The TYPO3 project - inspiring people to share!                         *
00021  *                                                                        */
00022 
00023 /**
00024  */
00025 abstract class Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase extends Tx_Extbase_Tests_Unit_BaseTestCase {
00026 
00027     /**
00028      * @var Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer
00029      */
00030     protected $viewHelperVariableContainer;
00031 
00032     /**
00033      * @var Tx_Fluid_Core_ViewHelper_TemplateVariableContainer
00034      */
00035     protected $templateVariableContainer;
00036 
00037     /**
00038      * @var Tx_Extbase_MVC_Web_Routing_UriBuilder
00039      */
00040     protected $uriBuilder;
00041 
00042     /**
00043      * @var Tx_Extbase_MVC_Controller_ControllerContext
00044      */
00045     protected $controllerContext;
00046 
00047     /**
00048      * @var Tx_Fluid_Core_ViewHelper_TagBuilder
00049      */
00050     protected $tagBuilder;
00051 
00052     /**
00053      * @var Tx_Fluid_Core_ViewHelper_Arguments
00054      */
00055     protected $arguments;
00056 
00057     /**
00058      * @var Tx_Extbase_MVC_Web_Request
00059      */
00060     protected $request;
00061 
00062     /**
00063      * @var Tx_Fluid_Core_Rendering_RenderingContext
00064      */
00065     protected $renderingContext;
00066 
00067     /**
00068      * @return void
00069      * @author Sebastian Kurfürst <sebastian@typo3.org>
00070      */
00071     public function setUp() {
00072         $this->viewHelperVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer');
00073         $this->templateVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer');
00074         $this->uriBuilder = $this->getMock('Tx_Extbase_MVC_Web_Routing_UriBuilder');
00075         $this->uriBuilder->expects($this->any())->method('reset')->will($this->returnValue($this->uriBuilder));
00076         $this->uriBuilder->expects($this->any())->method('setArguments')->will($this->returnValue($this->uriBuilder));
00077         $this->uriBuilder->expects($this->any())->method('setSection')->will($this->returnValue($this->uriBuilder));
00078         $this->uriBuilder->expects($this->any())->method('setFormat')->will($this->returnValue($this->uriBuilder));
00079         $this->uriBuilder->expects($this->any())->method('setCreateAbsoluteUri')->will($this->returnValue($this->uriBuilder));
00080         $this->uriBuilder->expects($this->any())->method('setAddQueryString')->will($this->returnValue($this->uriBuilder));
00081         $this->uriBuilder->expects($this->any())->method('setArgumentsToBeExcludedFromQueryString')->will($this->returnValue($this->uriBuilder));
00082         $this->uriBuilder->expects($this->any())->method('setLinkAccessRestrictedPages')->will($this->returnValue($this->uriBuilder));
00083         $this->uriBuilder->expects($this->any())->method('setTargetPageUid')->will($this->returnValue($this->uriBuilder));
00084         $this->uriBuilder->expects($this->any())->method('setTargetPageType')->will($this->returnValue($this->uriBuilder));
00085         $this->uriBuilder->expects($this->any())->method('setNoCache')->will($this->returnValue($this->uriBuilder));
00086         $this->uriBuilder->expects($this->any())->method('setUseCacheHash')->will($this->returnValue($this->uriBuilder));
00087         $this->request = $this->getMock('Tx_Extbase_MVC_Web_Request');
00088         $this->controllerContext = $this->getMock('Tx_Extbase_MVC_Controller_ControllerContext', array(), array(), '', FALSE);
00089         $this->controllerContext->expects($this->any())->method('getUriBuilder')->will($this->returnValue($this->uriBuilder));
00090         $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
00091         $this->tagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder');
00092         $this->arguments = $this->getMock('Tx_Fluid_Core_ViewHelper_Arguments', array(), array(), '', FALSE);
00093         $this->renderingContext = $this->getMock('Tx_Fluid_Core_Rendering_RenderingContext');
00094     }
00095 
00096     /**
00097      * @param Tx_Fluid_Core_ViewHelper_AbstractViewHelper $viewHelper
00098      * @return void
00099      * @author Sebastian Kurfürst <sebastian@typo3.org>
00100      */
00101     protected function injectDependenciesIntoViewHelper(Tx_Fluid_Core_ViewHelper_AbstractViewHelper $viewHelper) {
00102         $viewHelper->setViewHelperVariableContainer($this->viewHelperVariableContainer);
00103         $viewHelper->setTemplateVariableContainer($this->templateVariableContainer);
00104         $viewHelper->setControllerContext($this->controllerContext);
00105         $viewHelper->setRenderingContext($this->renderingContext);
00106         $viewHelper->setArguments($this->arguments);
00107         if ($viewHelper instanceof Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper) {
00108             $viewHelper->_set('tag', $this->tagBuilder);
00109         }
00110     }
00111 }
00112 ?>