TYPO3 API  SVNRelease
ErrorsViewHelperTest.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 
00026 include_once(dirname(__FILE__) . '/../Fixtures/ConstraintSyntaxTreeNode.php');
00027 require_once(dirname(__FILE__) . '/../ViewHelperBaseTestcase.php');
00028 
00029 /**
00030  */
00031 class Tx_Fluid_Tests_Unit_ViewHelpers_Form_ErrorsViewHelperTest extends Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase {
00032     /**
00033      * @test
00034      * @author Christopher Hlubek <hlubek@networkteam.com>
00035      */
00036     public function renderWithoutSpecifiedNameLoopsThroughRootErrors() {
00037         $mockError1 = $this->getMock('Tx_Extbase_Error_Error', array(), array(), '', FALSE);
00038         $mockError2 = $this->getMock('Tx_Extbase_Error_Error', array(), array(), '', FALSE);
00039         $this->request->expects($this->atLeastOnce())->method('getErrors')->will($this->returnValue(array($mockError1, $mockError2)));
00040 
00041         $viewHelper = new Tx_Fluid_ViewHelpers_Form_ErrorsViewHelper();
00042         $this->injectDependenciesIntoViewHelper($viewHelper);
00043 
00044         $variableContainer = new Tx_Fluid_Core_ViewHelper_TemplateVariableContainer(array());
00045         $viewHelperNode = new Tx_Fluid_ViewHelpers_Fixtures_ConstraintSyntaxTreeNode($variableContainer);
00046         $viewHelper->setViewHelperNode($viewHelperNode);
00047         $viewHelper->setTemplateVariableContainer($variableContainer);
00048 
00049         $viewHelper->render();
00050 
00051         $expectedCallProtocol = array(
00052             array('error' => $mockError1),
00053             array('error' => $mockError2)
00054         );
00055         $this->assertEquals($expectedCallProtocol, $viewHelperNode->callProtocol, 'The call protocol differs');
00056     }
00057 
00058 }
00059 ?>