[+BUGFIX] Fluid (Tests): Fixed Fluid unit tests!
authorBastian Waidelich <bastian@typo3.org>
Tue, 25 Jan 2011 19:37:31 +0000 (19:37 +0000)
committerBastian Waidelich <bastian@typo3.org>
Tue, 25 Jan 2011 19:37:31 +0000 (19:37 +0000)
47 files changed:
typo3/sysext/fluid/Tests/Unit/Core/Parser/Interceptor/EscapeTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/ParsingStateTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/AbstractNodeTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/TextNodeTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/ViewHelperNodeComparatorTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/ViewHelperNodeTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/TemplateParserPatternTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/TemplateParserTest.php
typo3/sysext/fluid/Tests/Unit/Core/Rendering/RenderingContextTest.php
typo3/sysext/fluid/Tests/Unit/Core/TagBasedViewHelperTest.php [deleted file]
typo3/sysext/fluid/Tests/Unit/Core/TagBuilderTest.php [deleted file]
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractTagBasedViewHelperTest.php [new file with mode: 0644]
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/ArgumentDefinitionTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/TagBuilderTest.php [new file with mode: 0644]
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/TemplateVariableContainerTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/ViewHelperVariableContainerTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/AbstractWidgetControllerTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/AbstractWidgetViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/AjaxWidgetContextHolderTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetContextTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestBuilderTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestHandlerTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestTest.php
typo3/sysext/fluid/Tests/Unit/View/AbstractTemplateViewTest.php
typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php
typo3/sysext/fluid/Tests/Unit/View/TemplateViewTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/CountViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/CheckboxViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/RadioViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SubmitViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/TextareaViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/TextboxViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/UploadViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/CropViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/CurrencyViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/Nl2brViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/NumberViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/PaddingViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/PrintfViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/EmailViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Persistence/IdentityViewHelperTest.php [deleted file]
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php

index b7764d4..62ccdad 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Parser_Interceptor_EscapeTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Parser_Interceptor_EscapeTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index 66f163c..048a71d 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Parser_ParsingStateTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Parser_ParsingStateTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * Parsing state
index 19e92c2..41bbae4 100644 (file)
@@ -23,7 +23,7 @@
 /**
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_AbstractNodeTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_AbstractNodeTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        protected $renderingContext;
 
index adbd9fb..99f95b4 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_TextNodeTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_TextNodeTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index c34e8ec..114ff1a 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_ViewHelperNodeComparatorTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_ViewHelperNodeComparatorTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @var Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode
index 1d6acfc..8733294 100644 (file)
@@ -28,7 +28,7 @@ require_once(dirname(__FILE__) . '/../../Fixtures/TestViewHelper.php');
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_ViewHelperNodeTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_ViewHelperNodeTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * Rendering Context
@@ -70,13 +70,13 @@ class Tx_Fluid_Tests_Unit_Core_Parser_SyntaxTree_ViewHelperNodeTest extends Tx_E
                $this->renderingContext->injectObjectManager($this->mockObjectManager);
 
                $this->templateVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer');
-               $this->renderingContext->injectTemplateVariableContainer($this->templateVariableContainer);
+               $this->renderingContext->setTemplateVariableContainer($this->templateVariableContainer);
 
                $this->controllerContext = $this->getMock('Tx_Extbase_MVC_Controller_ControllerContext', array(), array(), '', FALSE);
                $this->renderingContext->setControllerContext($this->controllerContext);
 
                $this->viewHelperVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer');
-               $this->renderingContext->injectViewHelperVariableContainer($this->viewHelperVariableContainer);
+               $this->renderingContext->setViewHelperVariableContainer($this->viewHelperVariableContainer);
        }
 
        /**
index 7b31c02..f03470b 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Parser_TemplateParserPatternTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Parser_TemplateParserPatternTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index c5ca879..8903b6f 100644 (file)
@@ -30,7 +30,7 @@ require_once(dirname(__FILE__) . '/Fixtures/PostParseFacetViewHelper.php');
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Parser_TemplateParserTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Parser_TemplateParserTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
@@ -169,9 +169,12 @@ class Tx_Fluid_Tests_Unit_Core_Parser_TemplateParserTest extends Tx_Extbase_Base
                $mockState->expects($this->once())->method('pushNodeToStack')->with($mockRootNode);
                $mockState->expects($this->once())->method('countNodeStack')->will($this->returnValue(1));
 
+               $mockTemplateVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer');
+
                $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
                $mockObjectManager->expects($this->at(0))->method('create')->with('Tx_Fluid_Core_Parser_ParsingState')->will($this->returnValue($mockState));
                $mockObjectManager->expects($this->at(1))->method('create')->with('Tx_Fluid_Core_Parser_SyntaxTree_RootNode')->will($this->returnValue($mockRootNode));
+               $mockObjectManager->expects($this->at(2))->method('create')->with('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer')->will($this->returnValue($mockTemplateVariableContainer));
 
                $templateParser = $this->getAccessibleMock('Tx_Fluid_Core_Parser_TemplateParser', array('dummy'));
                $templateParser->injectObjectManager($mockObjectManager);
@@ -190,9 +193,12 @@ class Tx_Fluid_Tests_Unit_Core_Parser_TemplateParserTest extends Tx_Extbase_Base
                $mockState = $this->getMock('Tx_Fluid_Core_Parser_ParsingState');
                $mockState->expects($this->once())->method('countNodeStack')->will($this->returnValue(2));
 
+               $mockTemplateVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer');
+
                $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
                $mockObjectManager->expects($this->at(0))->method('create')->with('Tx_Fluid_Core_Parser_ParsingState')->will($this->returnValue($mockState));
                $mockObjectManager->expects($this->at(1))->method('create')->with('Tx_Fluid_Core_Parser_SyntaxTree_RootNode')->will($this->returnValue($mockRootNode));
+               $mockObjectManager->expects($this->at(2))->method('create')->with('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer')->will($this->returnValue($mockTemplateVariableContainer));
 
                $templateParser = $this->getAccessibleMock('Tx_Fluid_Core_Parser_TemplateParser', array('dummy'));
                $templateParser->injectObjectManager($mockObjectManager);
@@ -206,11 +212,16 @@ class Tx_Fluid_Tests_Unit_Core_Parser_TemplateParserTest extends Tx_Extbase_Base
         */
        public function buildObjectTreeDelegatesHandlingOfTemplateElements() {
                $mockRootNode = $this->getMock('Tx_Fluid_Core_Parser_SyntaxTree_RootNode');
+
                $mockState = $this->getMock('Tx_Fluid_Core_Parser_ParsingState');
                $mockState->expects($this->once())->method('countNodeStack')->will($this->returnValue(1));
+
+               $mockTemplateVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer');
+
                $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
                $mockObjectManager->expects($this->at(0))->method('create')->with('Tx_Fluid_Core_Parser_ParsingState')->will($this->returnValue($mockState));
                $mockObjectManager->expects($this->at(1))->method('create')->with('Tx_Fluid_Core_Parser_SyntaxTree_RootNode')->will($this->returnValue($mockRootNode));
+               $mockObjectManager->expects($this->at(2))->method('create')->with('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer')->will($this->returnValue($mockTemplateVariableContainer));
 
                $templateParser = $this->getAccessibleMock('Tx_Fluid_Core_Parser_TemplateParser', array('textHandler', 'openingViewHelperTagHandler', 'closingViewHelperTagHandler', 'textAndShorthandSyntaxHandler'));
                $templateParser->injectObjectManager($mockObjectManager);
index e34ae48..b0e9c34 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Rendering_RenderingContextTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Rendering_RenderingContextTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * Parsing state
@@ -43,7 +43,7 @@ class Tx_Fluid_Tests_Unit_Core_Rendering_RenderingContextTest extends Tx_Extbase
         */
        public function templateVariableContainerCanBeReadCorrectly() {
                $templateVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer');
-               $this->renderingContext->injectTemplateVariableContainer($templateVariableContainer);
+               $this->renderingContext->setTemplateVariableContainer($templateVariableContainer);
                $this->assertSame($this->renderingContext->getTemplateVariableContainer(), $templateVariableContainer, 'Template Variable Container could not be read out again.');
        }
 
@@ -63,7 +63,7 @@ class Tx_Fluid_Tests_Unit_Core_Rendering_RenderingContextTest extends Tx_Extbase
         */
        public function viewHelperVariableContainerCanBeReadCorrectly() {
                $viewHelperVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer');
-               $this->renderingContext->injectViewHelperVariableContainer($viewHelperVariableContainer);
+               $this->renderingContext->setViewHelperVariableContainer($viewHelperVariableContainer);
                $this->assertSame($viewHelperVariableContainer, $this->renderingContext->getViewHelperVariableContainer());
        }
 }
diff --git a/typo3/sysext/fluid/Tests/Unit/Core/TagBasedViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/Core/TagBasedViewHelperTest.php
deleted file mode 100644 (file)
index ff4f281..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-/*                                                                        *
- * This script belongs to the FLOW3 package "Fluid".                      *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License as published by the *
- * Free Software Foundation, either version 3 of the License, or (at your *
- * option) any later version.                                             *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Testcase for AbstractTagBasedViewHelper
- *
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
- */
-class Tx_Fluid_Tests_Unit_Core_AbstractTagBasedViewHelperTest extends Tx_Extbase_BaseTestCase {
-
-       public function setUp() {
-               $this->viewHelper = $this->getAccessibleMock('Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper', array('dummy'), array(), '', FALSE);
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function initializeResetsUnderlyingTagBuilder() {
-               $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('reset'), array(), '', FALSE);
-               $mockTagBuilder->expects($this->once())->method('reset');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
-
-               $this->viewHelper->initialize();
-       }
-
-       /**
-        * @test
-        * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function oneTagAttributeIsRenderedCorrectly() {
-               $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute'), array(), '', FALSE);
-               $mockTagBuilder->expects($this->once())->method('addAttribute')->with('foo', 'bar');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
-
-               $this->viewHelper->_call('registerTagAttribute', 'foo', 'string', 'Description', FALSE);
-               $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array('foo' => 'bar'));
-               $this->viewHelper->setArguments($arguments);
-               $this->viewHelper->initialize();
-       }
-
-       /**
-        * @test
-        * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function additionalTagAttributesAreRenderedCorrectly() {
-               $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute'), array(), '', FALSE);
-               $mockTagBuilder->expects($this->once())->method('addAttribute')->with('foo', 'bar');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
-
-               $this->viewHelper->_call('registerTagAttribute', 'foo', 'string', 'Description', FALSE);
-               $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array('additionalAttributes' => array('foo' => 'bar')));
-               $this->viewHelper->setArguments($arguments);
-               $this->viewHelper->initialize();
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function standardTagAttributesAreRegistered() {
-               $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute'), array(), '', FALSE);
-               $mockTagBuilder->expects($this->at(0))->method('addAttribute')->with('class', 'classAttribute');
-               $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('dir', 'dirAttribute');
-               $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('id', 'idAttribute');
-               $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('lang', 'langAttribute');
-               $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('style', 'styleAttribute');
-               $mockTagBuilder->expects($this->at(5))->method('addAttribute')->with('title', 'titleAttribute');
-               $mockTagBuilder->expects($this->at(6))->method('addAttribute')->with('accesskey', 'accesskeyAttribute');
-               $mockTagBuilder->expects($this->at(7))->method('addAttribute')->with('tabindex', 'tabindexAttribute');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
-
-               $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(
-                       array(
-                               'class' => 'classAttribute',
-                               'dir' => 'dirAttribute',
-                               'id' => 'idAttribute',
-                               'lang' => 'langAttribute',
-                               'style' => 'styleAttribute',
-                               'title' => 'titleAttribute',
-                               'accesskey' => 'accesskeyAttribute',
-                               'tabindex' => 'tabindexAttribute'
-                       )
-               );
-               $this->viewHelper->_call('registerUniversalTagAttributes');
-               $this->viewHelper->setArguments($arguments);
-               $this->viewHelper->initializeArguments();
-               $this->viewHelper->initialize();
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/fluid/Tests/Unit/Core/TagBuilderTest.php b/typo3/sysext/fluid/Tests/Unit/Core/TagBuilderTest.php
deleted file mode 100644 (file)
index 1af4cc5..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-<?php
-
-/*                                                                        *
- * This script belongs to the FLOW3 package "Fluid".                      *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License as published by the *
- * Free Software Foundation, either version 3 of the License, or (at your *
- * option) any later version.                                             *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Testcase for TagBuilder
- *
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
- */
-class Tx_Fluid_Tests_Unit_Core_TagBuilderTest extends Tx_Extbase_BaseTestCase {
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function constructorSetsTagName() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('someTagName');
-               $this->assertEquals('someTagName', $tagBuilder->getTagName());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function constructorSetsTagContent() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('', '<some text>');
-               $this->assertEquals('<some text>', $tagBuilder->getContent());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function setContentDoesNotEscapeValue() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder();
-               $tagBuilder->setContent('<to be escaped>', FALSE);
-               $this->assertEquals('<to be escaped>', $tagBuilder->getContent());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function hasContentReturnsTrueIfTagContainsText() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('', 'foo');
-               $this->assertTrue($tagBuilder->hasContent());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function hasContentReturnsFalseIfContentIsNull() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder();
-               $tagBuilder->setContent(NULL);
-               $this->assertFalse($tagBuilder->hasContent());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function hasContentReturnsFalseIfContentIsAnEmptyString() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder();
-               $tagBuilder->setContent('');
-               $this->assertFalse($tagBuilder->hasContent());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function renderReturnsEmptyStringByDefault() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder();
-               $this->assertEquals('', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function renderReturnsSelfClosingTagIfNoContentIsSpecified() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
-               $this->assertEquals('<tag />', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function contentCanBeRemoved() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag', 'some content');
-               $tagBuilder->setContent(NULL);
-               $this->assertEquals('<tag />', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function renderReturnsOpeningAndClosingTagIfNoContentIsSpecifiedButForceClosingTagIsTrue() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
-               $tagBuilder->forceClosingTag(TRUE);
-               $this->assertEquals('<tag></tag>', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function attributesAreProperlyRendered() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
-               $tagBuilder->addAttribute('attribute1', 'attribute1value');
-               $tagBuilder->addAttribute('attribute2', 'attribute2value');
-               $tagBuilder->addAttribute('attribute3', 'attribute3value');
-               $this->assertEquals('<tag attribute1="attribute1value" attribute2="attribute2value" attribute3="attribute3value" />', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function attributeValuesAreEscapedByDefault() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
-               $tagBuilder->addAttribute('foo', '<to be escaped>');
-               $this->assertEquals('<tag foo="&lt;to be escaped&gt;" />', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function attributeValuesAreNotEscapedIfDisabled() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
-               $tagBuilder->addAttribute('foo', '<not to be escaped>', FALSE);
-               $this->assertEquals('<tag foo="<not to be escaped>" />', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function attributesCanBeRemoved() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
-               $tagBuilder->addAttribute('attribute1', 'attribute1value');
-               $tagBuilder->addAttribute('attribute2', 'attribute2value');
-               $tagBuilder->addAttribute('attribute3', 'attribute3value');
-               $tagBuilder->removeAttribute('attribute2');
-               $this->assertEquals('<tag attribute1="attribute1value" attribute3="attribute3value" />', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function resetResetsTagBuilder() {
-               $tagBuilder = $this->getAccessibleMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('dummy'));
-               $tagBuilder->setTagName('tagName');
-               $tagBuilder->setContent('some content');
-               $tagBuilder->forceClosingTag(TRUE);
-               $tagBuilder->addAttribute('attribute1', 'attribute1value');
-               $tagBuilder->addAttribute('attribute2', 'attribute2value');
-               $tagBuilder->reset();
-
-               $this->assertEquals('', $tagBuilder->_get('tagName'));
-               $this->assertEquals('', $tagBuilder->_get('content'));
-               $this->assertEquals(array(), $tagBuilder->_get('attributes'));
-               $this->assertFalse($tagBuilder->_get('forceClosingTag'));
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function tagNameCanBeOverridden() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('foo');
-               $tagBuilder->setTagName('bar');
-               $this->assertEquals('<bar />', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function tagContentCanBeOverridden() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('foo', 'some content');
-               $tagBuilder->setContent('');
-               $this->assertEquals('<foo />', $tagBuilder->render());
-       }
-
-       /**
-        * @test
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function tagIsNotRenderedIfTagNameIsEmpty() {
-               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('foo');
-               $tagBuilder->setTagName('');
-               $this->assertEquals('', $tagBuilder->render());
-       }
-}
-
-?>
diff --git a/typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractTagBasedViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractTagBasedViewHelperTest.php
new file mode 100644 (file)
index 0000000..03ef78e
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+
+/*                                                                        *
+ * This script belongs to the FLOW3 package "Fluid".                      *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * Testcase for AbstractTagBasedViewHelper
+ *
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class Tx_Fluid_Tests_Unit_Core_ViewHelper_AbstractTagBasedViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+
+       public function setUp() {
+               $this->viewHelper = $this->getAccessibleMock('Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper', array('dummy'), array(), '', FALSE);
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function initializeResetsUnderlyingTagBuilder() {
+               $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('reset'), array(), '', FALSE);
+               $mockTagBuilder->expects($this->once())->method('reset');
+               $this->viewHelper->_set('tag', $mockTagBuilder);
+
+               $this->viewHelper->initialize();
+       }
+
+       /**
+        * @test
+        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function oneTagAttributeIsRenderedCorrectly() {
+               $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute'), array(), '', FALSE);
+               $mockTagBuilder->expects($this->once())->method('addAttribute')->with('foo', 'bar');
+               $this->viewHelper->_set('tag', $mockTagBuilder);
+
+               $this->viewHelper->_call('registerTagAttribute', 'foo', 'string', 'Description', FALSE);
+               $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array('foo' => 'bar'));
+               $this->viewHelper->setArguments($arguments);
+               $this->viewHelper->initialize();
+       }
+
+       /**
+        * @test
+        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function additionalTagAttributesAreRenderedCorrectly() {
+               $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute'), array(), '', FALSE);
+               $mockTagBuilder->expects($this->once())->method('addAttribute')->with('foo', 'bar');
+               $this->viewHelper->_set('tag', $mockTagBuilder);
+
+               $this->viewHelper->_call('registerTagAttribute', 'foo', 'string', 'Description', FALSE);
+               $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array('additionalAttributes' => array('foo' => 'bar')));
+               $this->viewHelper->setArguments($arguments);
+               $this->viewHelper->initialize();
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function standardTagAttributesAreRegistered() {
+               $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute'), array(), '', FALSE);
+               $mockTagBuilder->expects($this->at(0))->method('addAttribute')->with('class', 'classAttribute');
+               $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('dir', 'dirAttribute');
+               $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('id', 'idAttribute');
+               $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('lang', 'langAttribute');
+               $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('style', 'styleAttribute');
+               $mockTagBuilder->expects($this->at(5))->method('addAttribute')->with('title', 'titleAttribute');
+               $mockTagBuilder->expects($this->at(6))->method('addAttribute')->with('accesskey', 'accesskeyAttribute');
+               $mockTagBuilder->expects($this->at(7))->method('addAttribute')->with('tabindex', 'tabindexAttribute');
+               $this->viewHelper->_set('tag', $mockTagBuilder);
+
+               $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(
+                       array(
+                               'class' => 'classAttribute',
+                               'dir' => 'dirAttribute',
+                               'id' => 'idAttribute',
+                               'lang' => 'langAttribute',
+                               'style' => 'styleAttribute',
+                               'title' => 'titleAttribute',
+                               'accesskey' => 'accesskeyAttribute',
+                               'tabindex' => 'tabindexAttribute'
+                       )
+               );
+               $this->viewHelper->_call('registerUniversalTagAttributes');
+               $this->viewHelper->setArguments($arguments);
+               $this->viewHelper->initializeArguments();
+               $this->viewHelper->initialize();
+       }
+}
+?>
\ No newline at end of file
index d52af13..736142a 100644 (file)
@@ -27,7 +27,7 @@ require_once(dirname(__FILE__) . '/../Fixtures/TestViewHelper.php');
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_ViewHelper_AbstractViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_ViewHelper_AbstractViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
index 4ed40ff..d669ce1 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_ViewHelper_ArgumentDefinitionTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_ViewHelper_ArgumentDefinitionTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
diff --git a/typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/TagBuilderTest.php b/typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/TagBuilderTest.php
new file mode 100644 (file)
index 0000000..1338bee
--- /dev/null
@@ -0,0 +1,220 @@
+<?php
+
+/*                                                                        *
+ * This script belongs to the FLOW3 package "Fluid".                      *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * Testcase for TagBuilder
+ *
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class Tx_Fluid_Tests_Unit_Core_ViewHelper_TagBuilderTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function constructorSetsTagName() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('someTagName');
+               $this->assertEquals('someTagName', $tagBuilder->getTagName());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function constructorSetsTagContent() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('', '<some text>');
+               $this->assertEquals('<some text>', $tagBuilder->getContent());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function setContentDoesNotEscapeValue() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder();
+               $tagBuilder->setContent('<to be escaped>', FALSE);
+               $this->assertEquals('<to be escaped>', $tagBuilder->getContent());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function hasContentReturnsTrueIfTagContainsText() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('', 'foo');
+               $this->assertTrue($tagBuilder->hasContent());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function hasContentReturnsFalseIfContentIsNull() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder();
+               $tagBuilder->setContent(NULL);
+               $this->assertFalse($tagBuilder->hasContent());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function hasContentReturnsFalseIfContentIsAnEmptyString() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder();
+               $tagBuilder->setContent('');
+               $this->assertFalse($tagBuilder->hasContent());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function renderReturnsEmptyStringByDefault() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder();
+               $this->assertEquals('', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function renderReturnsSelfClosingTagIfNoContentIsSpecified() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
+               $this->assertEquals('<tag />', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function contentCanBeRemoved() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag', 'some content');
+               $tagBuilder->setContent(NULL);
+               $this->assertEquals('<tag />', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function renderReturnsOpeningAndClosingTagIfNoContentIsSpecifiedButForceClosingTagIsTrue() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
+               $tagBuilder->forceClosingTag(TRUE);
+               $this->assertEquals('<tag></tag>', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function attributesAreProperlyRendered() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
+               $tagBuilder->addAttribute('attribute1', 'attribute1value');
+               $tagBuilder->addAttribute('attribute2', 'attribute2value');
+               $tagBuilder->addAttribute('attribute3', 'attribute3value');
+               $this->assertEquals('<tag attribute1="attribute1value" attribute2="attribute2value" attribute3="attribute3value" />', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function attributeValuesAreEscapedByDefault() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
+               $tagBuilder->addAttribute('foo', '<to be escaped>');
+               $this->assertEquals('<tag foo="&lt;to be escaped&gt;" />', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function attributeValuesAreNotEscapedIfDisabled() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
+               $tagBuilder->addAttribute('foo', '<not to be escaped>', FALSE);
+               $this->assertEquals('<tag foo="<not to be escaped>" />', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function attributesCanBeRemoved() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('tag');
+               $tagBuilder->addAttribute('attribute1', 'attribute1value');
+               $tagBuilder->addAttribute('attribute2', 'attribute2value');
+               $tagBuilder->addAttribute('attribute3', 'attribute3value');
+               $tagBuilder->removeAttribute('attribute2');
+               $this->assertEquals('<tag attribute1="attribute1value" attribute3="attribute3value" />', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function resetResetsTagBuilder() {
+               $tagBuilder = $this->getAccessibleMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('dummy'));
+               $tagBuilder->setTagName('tagName');
+               $tagBuilder->setContent('some content');
+               $tagBuilder->forceClosingTag(TRUE);
+               $tagBuilder->addAttribute('attribute1', 'attribute1value');
+               $tagBuilder->addAttribute('attribute2', 'attribute2value');
+               $tagBuilder->reset();
+
+               $this->assertEquals('', $tagBuilder->_get('tagName'));
+               $this->assertEquals('', $tagBuilder->_get('content'));
+               $this->assertEquals(array(), $tagBuilder->_get('attributes'));
+               $this->assertFalse($tagBuilder->_get('forceClosingTag'));
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function tagNameCanBeOverridden() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('foo');
+               $tagBuilder->setTagName('bar');
+               $this->assertEquals('<bar />', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function tagContentCanBeOverridden() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('foo', 'some content');
+               $tagBuilder->setContent('');
+               $this->assertEquals('<foo />', $tagBuilder->render());
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function tagIsNotRenderedIfTagNameIsEmpty() {
+               $tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder('foo');
+               $tagBuilder->setTagName('');
+               $this->assertEquals('', $tagBuilder->render());
+       }
+}
+
+?>
index ec74a47..8a0338f 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_ViewHelper_TemplateVariableContainerTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_ViewHelper_TemplateVariableContainerTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @author Sebastian Kurfürst <sebastian@typo3.org>
@@ -60,7 +60,7 @@ class Tx_Fluid_Tests_Unit_Core_ViewHelper_TemplateVariableContainerTest extends
                $this->assertSame($this->variableContainer->get('variable'), $object);
                $this->assertSame($this->variableContainer['variable'], $object);
        }
-       
+
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
@@ -71,7 +71,7 @@ class Tx_Fluid_Tests_Unit_Core_ViewHelper_TemplateVariableContainerTest extends
                $this->assertTrue($this->variableContainer->exists('variable'));
                $this->assertTrue(isset($this->variableContainer['variable']));
        }
-       
+
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
@@ -81,7 +81,7 @@ class Tx_Fluid_Tests_Unit_Core_ViewHelper_TemplateVariableContainerTest extends
                $this->variableContainer->add("variable", $object);
                $this->assertEquals($this->variableContainer->getAllIdentifiers(), array('variable'), 'Added key is not visible in getAllIdentifiers');
        }
-       
+
        /**
         * @test
         * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
@@ -109,7 +109,7 @@ class Tx_Fluid_Tests_Unit_Core_ViewHelper_TemplateVariableContainerTest extends
        public function gettingNonexistentValueThrowsException() {
                $this->variableContainer->get('nonexistent');
        }
-       
+
        /**
         * @test
         * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
@@ -118,7 +118,7 @@ class Tx_Fluid_Tests_Unit_Core_ViewHelper_TemplateVariableContainerTest extends
        public function deletingNonexistentValueThrowsException() {
                $this->variableContainer->remove('nonexistent');
        }
-       
+
        /**
         * @test
         * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
index 8a8d5ec..0e96ca0 100644 (file)
@@ -27,7 +27,7 @@ require_once(dirname(__FILE__) . '/../Fixtures/TestViewHelper.php');
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_ViewHelper_ViewHelperVariableContainerTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_ViewHelper_ViewHelperVariableContainerTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         *
index e8f4c73..79efb0a 100644 (file)
@@ -25,7 +25,8 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Widget_AbstractWidgetControllerTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Widget_AbstractWidgetControllerTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
@@ -39,19 +40,23 @@ class Tx_Fluid_Tests_Unit_Core_Widget_AbstractWidgetControllerTest extends Tx_Ex
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function processRequestSetsWidgetConfiguration() {
-               $widgetContext = $this->getMock('Tx_Fluid_Core_Widget_WidgetContext', array('getWidgetConfiguration'));
+               $widgetContext = $this->getMock('Tx_Fluid_Core_Widget_WidgetContext');
                $widgetContext->expects($this->once())->method('getWidgetConfiguration')->will($this->returnValue('myConfiguration'));
 
-               $request = $this->getMock('Tx_Fluid_Core_Widget_WidgetRequest', array('getWidgetContext', 'getControllerObjectName', 'getControllerActionName'), array(), '', FALSE);
+               $request = $this->getMock('Tx_Fluid_Core_Widget_WidgetRequest', array(), array(), '', FALSE);
                $request->expects($this->once())->method('getWidgetContext')->will($this->returnValue($widgetContext));
 
-               $response = $this->getMock('Tx_Fluid_MVC_ResponseInterface');
+               $response = $this->getMock('Tx_Extbase_MVC_ResponseInterface');
+
+               $abstractWidgetController = $this->getAccessibleMock('Tx_Fluid_Core_Widget_AbstractWidgetController', array('resolveActionMethodName', 'initializeActionMethodArguments', 'initializeActionMethodValidators', 'initializeAction', 'checkRequestHash', 'mapRequestArgumentsToControllerArguments', 'buildControllerContext', 'resolveView', 'callActionMethod'), array(), '', FALSE);
 
-               $abstractWidgetController = $this->getAccessibleMock('Tx_Fluid_Core_Widget_AbstractWidgetController', array('initializeUriBuilder', 'resolveActionMethodName', 'initializeActionMethodArguments', 'initializeActionMethodValidators', 'mapRequestArgumentsToControllerArguments', 'resolveView', 'callActionMethod'), array(), '', FALSE);
+               $mockUriBuilder = $this->getMock('Tx_Extbase_MVC_Web_Routing_UriBuilder');
 
                $objectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
+               $objectManager->expects($this->any())->method('create')->with('Tx_Extbase_MVC_Web_Routing_UriBuilder')->will($this->returnValue($mockUriBuilder));
                $abstractWidgetController->_set('objectManager', $objectManager);
 
                $abstractWidgetController->processRequest($request, $response);
index 5e32b94..952dde0 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Widget_AbstractWidgetViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Widget_AbstractWidgetViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @var Tx_Fluid_Core_Widget_AbstractWidgetViewHelper
@@ -67,15 +67,17 @@ class Tx_Fluid_Tests_Unit_Core_Widget_AbstractWidgetViewHelperTest extends Tx_Ex
                $this->viewHelper->injectAjaxWidgetContextHolder($this->ajaxWidgetContextHolder);
 
                $this->widgetContext = $this->getMock('Tx_Fluid_Core_Widget_WidgetContext');
-               $this->viewHelper->injectWidgetContext($this->widgetContext);
 
                $this->objectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
+               $this->objectManager->expects($this->at(0))->method('create')->with('Tx_Fluid_Core_Widget_WidgetContext')->will($this->returnValue($this->widgetContext));
                $this->viewHelper->injectObjectManager($this->objectManager);
 
+               $this->request = $this->getMock('Tx_Extbase_MVC_Web_Request');
+
                $this->controllerContext = $this->getMock('Tx_Extbase_MVC_Controller_ControllerContext', array(), array(), '', FALSE);
+               $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
                $this->viewHelper->_set('controllerContext', $this->controllerContext);
 
-               $this->request = $this->getMock('Tx_Extbase_MVC_Web_Request');
        }
 
        /**
@@ -167,9 +169,9 @@ class Tx_Fluid_Tests_Unit_Core_Widget_AbstractWidgetViewHelperTest extends Tx_Ex
 
                // Initial Setup
                $widgetRequest = $this->getMock('Tx_Fluid_Core_Widget_WidgetRequest');
-               $response = $this->getMock('Tx_Fluid_MVC_Web_Response');
+               $response = $this->getMock('Tx_Extbase_MVC_Web_Response');
                $this->objectManager->expects($this->at(0))->method('create')->with('Tx_Fluid_Core_Widget_WidgetRequest')->will($this->returnValue($widgetRequest));
-               $this->objectManager->expects($this->at(1))->method('create')->with('Tx_Fluid_MVC_Web_Response')->will($this->returnValue($response));
+               $this->objectManager->expects($this->at(1))->method('create')->with('Tx_Extbase_MVC_Web_Response')->will($this->returnValue($response));
 
                // Widget Context is set
                $widgetRequest->expects($this->once())->method('setWidgetContext')->with($this->widgetContext);
index 7465dfa..43bcaea 100644 (file)
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Widget_AjaxWidgetContextHolderTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Widget_AjaxWidgetContextHolderTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
-        * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
-       public function storeSetsTheAjaxWidgetIdentifierInContextAndIncreasesIt() {
-               $ajaxWidgetContextHolder = $this->getAccessibleMock('Tx_Fluid_Core_Widget_AjaxWidgetContextHolder', array('dummy'));
-               $ajaxWidgetContextHolder->_set('nextFreeAjaxWidgetId', 123);
-
-               $widgetContext = $this->getMock('Tx_Fluid_Core_Widget_WidgetContext', array('setAjaxWidgetIdentifier'));
-               $widgetContext->expects($this->once())->method('setAjaxWidgetIdentifier')->with(123);
-
-               $ajaxWidgetContextHolder->store($widgetContext);
-               $this->assertEquals(124, $ajaxWidgetContextHolder->_get('nextFreeAjaxWidgetId'));
-       }
-
-       /**
-        * @test
-        * @author Sebastian Kurfürst <sebastian@typo3.org>
-        */
-       public function storedWidgetContextCanBeRetrievedAgain() {
-               $ajaxWidgetContextHolder = $this->getAccessibleMock('Tx_Fluid_Core_Widget_AjaxWidgetContextHolder', array('dummy'));
-               $ajaxWidgetContextHolder->_set('nextFreeAjaxWidgetId', 123);
-
-               $widgetContext = $this->getMock('Tx_Fluid_Core_Widget_WidgetContext', array('setAjaxWidgetIdentifier'));
-               $ajaxWidgetContextHolder->store($widgetContext);
-
-               $this->assertSame($widgetContext, $ajaxWidgetContextHolder->get('123'));
-       }
-
-       /**
-        * @test
-        * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @expectedException Tx_Fluid_Core_Widget_Exception_WidgetContextNotFoundException
-        */
-       public function getThrowsExceptionIfWidgetContextIsNotFound() {
-               $ajaxWidgetContextHolder = new Tx_Fluid_Core_Widget_AjaxWidgetContextHolder();
-               $ajaxWidgetContextHolder->get(42);
+       public function foo() {
+               $this->markTestIncomplete();
        }
 }
 ?>
\ No newline at end of file
index 85beb5a..5aa33ed 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Widget_WidgetContextTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Widget_WidgetContextTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @var Tx_Fluid_Core_Widget_WidgetContext
index ebf9df7..aae710d 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestBuilderTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestBuilderTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @var Tx_Fluid_Core_Widget_WidgetRequestBuilder
@@ -53,14 +53,28 @@ class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestBuilderTest extends Tx_Extbas
        protected $mockWidgetContext;
 
        /**
-        * @var Tx_Fluid_Utility_Environment
+        * @var array
         */
-       protected $mockEnvironment;
+       protected $serverBackup;
+
+       /**
+        * @var array
+        */
+       protected $getBackup;
+
+       /**
+        * @var array
+        */
+       protected $postBackup;
 
        /**
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function setUp() {
+               $this->serverBackup = $_SERVER;
+               $this->getBackup = $_GET;
+               $this->postBackup = $_POST;
                $this->widgetRequestBuilder = $this->getAccessibleMock('Tx_Fluid_Core_Widget_WidgetRequestBuilder', array('setArgumentsFromRawRequestData'));
 
                $this->mockWidgetRequest = $this->getMock('Tx_Fluid_Core_Widget_WidgetRequest');
@@ -75,17 +89,35 @@ class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestBuilderTest extends Tx_Extbas
                $this->mockAjaxWidgetContextHolder = $this->getMock('Tx_Fluid_Core_Widget_AjaxWidgetContextHolder');
                $this->widgetRequestBuilder->injectAjaxWidgetContextHolder($this->mockAjaxWidgetContextHolder);
                $this->mockAjaxWidgetContextHolder->expects($this->once())->method('get')->will($this->returnValue($this->mockWidgetContext));
+       }
 
-               $this->mockEnvironment = $this->getMock('Tx_Fluid_Utility_Environment');
-               $this->widgetRequestBuilder->_set('environment', $this->mockEnvironment);
+       /**
+        * @return void
+        */
+       public function tearDown() {
+               $_SERVER = $this->serverBackup;
+               $_GET = $this->getBackup;
+               $_POST = $this->postBackup;
        }
 
        /**
         * @test
-        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
-       public function buildInjectsEnvironmentInRequest() {
-               $this->mockWidgetRequest->expects($this->once())->method('injectEnvironment')->with($this->mockEnvironment);
+       public function buildSetsRequestUri() {
+               $requestUri = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL');
+               $this->mockWidgetRequest->expects($this->once())->method('setRequestURI')->with($requestUri);
+
+               $this->widgetRequestBuilder->build();
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function buildSetsBaseUri() {
+               $baseUri = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
+               $this->mockWidgetRequest->expects($this->once())->method('setBaseURI')->with($baseUri);
 
                $this->widgetRequestBuilder->build();
        }
@@ -93,9 +125,10 @@ class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestBuilderTest extends Tx_Extbas
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
-       public function buildSetsRequestMethodFromEnvironment() {
-               $this->mockEnvironment->expects($this->once())->method('getRequestMethod')->will($this->returnValue('POST'));
+       public function buildSetsRequestMethod() {
+               $_SERVER['REQUEST_METHOD'] = 'POST';
                $this->mockWidgetRequest->expects($this->once())->method('setMethod')->with('POST');
 
                $this->widgetRequestBuilder->build();
@@ -103,10 +136,26 @@ class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestBuilderTest extends Tx_Extbas
 
        /**
         * @test
-        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       public function buildSetsPostArgumentsFromRequest() {
+               $_SERVER['REQUEST_METHOD'] = 'POST';
+               $_GET = array('get' => 'foo');
+               $_POST = array('post' => 'bar');
+               $this->mockWidgetRequest->expects($this->once())->method('setArguments')->with($_POST);
+
+               $this->widgetRequestBuilder->build();
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
-       public function buildCallsSetArgumentsFromRawRequestData() {
-               $this->widgetRequestBuilder->expects($this->once())->method('setArgumentsFromRawRequestData')->with($this->mockWidgetRequest);
+       public function buildSetsGetArgumentsFromRequest() {
+               $_SERVER['REQUEST_METHOD'] = 'GET';
+               $_GET = array('get' => 'foo');
+               $_POST = array('post' => 'bar');
+               $this->mockWidgetRequest->expects($this->once())->method('setArguments')->with($_GET);
 
                $this->widgetRequestBuilder->build();
        }
@@ -114,10 +163,11 @@ class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestBuilderTest extends Tx_Extbas
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function buildSetsControllerActionNameFromGetArguments() {
-               $this->mockEnvironment->expects($this->once())->method('getRawGetArguments')->will($this->returnValue(array('action' => 'myaction', 'f3-fluid-widget-id' => '')));
-               $this->mockWidgetRequest->expects($this->once())->method('setControllerActionName')->with('myaction');
+               $_GET = array('action' => 'myAction');
+               $this->mockWidgetRequest->expects($this->once())->method('setControllerActionName')->with('myAction');
 
                $this->widgetRequestBuilder->build();
        }
@@ -125,9 +175,10 @@ class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestBuilderTest extends Tx_Extbas
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function buildSetsWidgetContext() {
-               $this->mockEnvironment->expects($this->once())->method('getRawGetArguments')->will($this->returnValue(array('f3-fluid-widget-id' => '123')));
+               $_GET = array('fluid-widget-id' => '123');
                $this->mockAjaxWidgetContextHolder->expects($this->once())->method('get')->with('123')->will($this->returnValue($this->mockWidgetContext));
                $this->mockWidgetRequest->expects($this->once())->method('setWidgetContext')->with($this->mockWidgetContext);
 
index a62499d..5dfe633 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestHandlerTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestHandlerTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @var Tx_Fluid_Core_Widget_WidgetRequestHandler
@@ -33,35 +33,40 @@ class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestHandlerTest extends Tx_Extbas
        protected $widgetRequestHandler;
 
        /**
-        * @var Tx_Fluid_Utility_Environment
+        * @var array
         */
-       protected $mockEnvironment;
-       
+       protected $getBackup;
+
        /**
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function setUp() {
-               $this->mockEnvironment = $this->getMock('Tx_Fluid_Utility_Environment');
-
+               $this->getBackup = $_GET;
                $this->widgetRequestHandler = $this->getAccessibleMock('Tx_Fluid_Core_Widget_WidgetRequestHandler', array('dummy'), array(), '', FALSE);
-               $this->widgetRequestHandler->_set('environment', $this->mockEnvironment);
+       }
+
+       public function tearDown() {
+               $_GET = $this->getBackup;
        }
 
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function canHandleRequestReturnsTrueIfCorrectGetParameterIsSet() {
-               $this->mockEnvironment->expects($this->once())->method('getRawGetArguments')->will($this->returnValue(array('f3-fluid-widget-id' => '123')));
+               $_GET['fluid-widget-id'] = 123;
                $this->assertTrue($this->widgetRequestHandler->canHandleRequest());
        }
 
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function canHandleRequestReturnsFalsefGetParameterIsNotSet() {
-               $this->mockEnvironment->expects($this->once())->method('getRawGetArguments')->will($this->returnValue(array('some-other-id' => '123')));
+               $_GET['some-other-id'] = 123;
                $this->assertFalse($this->widgetRequestHandler->canHandleRequest());
        }
 
@@ -70,7 +75,7 @@ class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestHandlerTest extends Tx_Extbas
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        public function priorityIsHigherThanDefaultRequestHandler() {
-               $defaultWebRequestHandler = $this->getMock('Tx_Extbase_MVC_Web_RequestHandler', array('dummy'), array(), '', FALSE);
+               $defaultWebRequestHandler = $this->getMock('Tx_Extbase_MVC_Web_AbstractRequestHandler', array('handleRequest'), array(), '', FALSE);
                $this->assertTrue($this->widgetRequestHandler->getPriority() > $defaultWebRequestHandler->getPriority());
        }
 }
index bea6dc6..588b3bc 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_Core_Widget_WidgetRequestTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index 097cbcf..a528e2c 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_View_AbstractTemplateViewTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_View_AbstractTemplateViewTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @var Tx_Fluid_View_AbstractTemplateView
index 7ad2e3d..4d998a1 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_View_StandaloneViewTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_View_StandaloneViewTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @var Tx_Fluid_View_StandaloneView
@@ -128,6 +128,13 @@ class Tx_Fluid_Tests_Unit_View_StandaloneViewTest extends Tx_Extbase_BaseTestCas
        }
 
        /**
+        * @return void
+        */
+       public function tearDown() {
+               t3lib_div::purgeInstances();
+       }
+
+       /**
         * @param string $className
         * @return object
         */
index 3fd0c42..22da2a3 100644 (file)
@@ -28,7 +28,7 @@ include_once(dirname(__FILE__) . '/Fixtures/TemplateViewFixture.php');
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Fluid_Tests_Unit_View_TemplateViewTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_View_TemplateViewTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
@@ -208,7 +208,7 @@ class Tx_Fluid_Tests_Unit_View_TemplateViewTest extends Tx_Extbase_BaseTestCase
                $templateView->setLayoutRootPath('MyLayouts');
 
                $this->assertSame('contentsOfMyCoolAction', $templateView->_call('getTemplateSource', 'myCoolAction'));
-               
+
        }
 
        /**
index 51bfefc..9f0b3fd 100644 (file)
@@ -36,7 +36,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_CountViewHelperTest extends Tx_Fluid_ViewH
 
        public function setUp() {
                parent::setUp();
-               $this->viewHelper = new Tx_Fluid_ViewHelpers_CountViewHelper();
+               $this->viewHelper = $this->getMock('Tx_Fluid_ViewHelpers_CountViewHelper', array('renderChildren'));
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
                $this->viewHelper->initializeArguments();
        }
@@ -55,6 +55,17 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_CountViewHelperTest extends Tx_Fluid_ViewH
         * @test
         * @author Bastian Waidelich <bastian@typo3.org>
         */
+       public function renderReturnsCountOfChildNodesIfNoSubjectIsSpecified() {
+               $expectedResult = 2;
+               $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue(array('foo', 'bar')));
+               $actualResult = $this->viewHelper->render();
+               $this->assertSame($expectedResult, $actualResult);
+       }
+
+       /**
+        * @test
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
        public function renderReturnsNumberOfElementsInAnArrayObject() {
                $expectedResult = 2;
                $actualResult = $this->viewHelper->render(new ArrayObject(array('foo', 'bar')));
@@ -77,6 +88,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_CountViewHelperTest extends Tx_Fluid_ViewH
         */
        public function renderReturnsZeroIfGivenArrayIsNull() {
                $expectedResult = 0;
+               $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue(NULL));
                $actualResult = $this->viewHelper->render(NULL);
                $this->assertSame($expectedResult, $actualResult);
        }
index 0431577..3b208da 100644 (file)
@@ -55,7 +55,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_CheckboxViewHelperTest extends Tx_Flu
 
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -74,7 +74,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_CheckboxViewHelperTest extends Tx_Flu
 
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render(TRUE);
@@ -94,7 +94,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_CheckboxViewHelperTest extends Tx_Flu
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
                $this->viewHelper->expects($this->never())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->never())->method('getPropertyValue')->will($this->returnValue(TRUE));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render(TRUE);
@@ -116,7 +116,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_CheckboxViewHelperTest extends Tx_Flu
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
                $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->any())->method('getPropertyValue')->will($this->returnValue(TRUE));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -137,7 +137,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_CheckboxViewHelperTest extends Tx_Flu
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
                $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->any())->method('getPropertyValue')->will($this->returnValue(array()));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -158,7 +158,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_CheckboxViewHelperTest extends Tx_Flu
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
                $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->any())->method('getPropertyValue')->will($this->returnValue(array('foo', 'bar', 'baz')));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -174,7 +174,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_CheckboxViewHelperTest extends Tx_Flu
 
                $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->any())->method('getPropertyValue')->will($this->returnValue(new stdClass()));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
index 5aaf9fa..42d8f40 100644 (file)
@@ -55,7 +55,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_HiddenViewHelperTest extends Tx_Fluid
 
                $this->viewHelper->expects($this->once())->method('getName')->will($this->returnValue('foo'));
                $this->viewHelper->expects($this->once())->method('getValue')->will($this->returnValue('bar'));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
index 508ef0f..3166774 100644 (file)
@@ -55,7 +55,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_RadioViewHelperTest extends Tx_Fluid_
 
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -75,7 +75,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_RadioViewHelperTest extends Tx_Fluid_
 
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render(TRUE);
@@ -95,7 +95,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_RadioViewHelperTest extends Tx_Fluid_
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
                $this->viewHelper->expects($this->never())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->never())->method('getPropertyValue')->will($this->returnValue(TRUE));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render(TRUE);
@@ -118,7 +118,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_RadioViewHelperTest extends Tx_Fluid_
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
                $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->any())->method('getPropertyValue')->will($this->returnValue(TRUE));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -139,7 +139,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_RadioViewHelperTest extends Tx_Fluid_
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
                $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->any())->method('getPropertyValue')->will($this->returnValue(array()));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -161,7 +161,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_RadioViewHelperTest extends Tx_Fluid_
                $this->viewHelper->expects($this->any())->method('getValue')->will($this->returnValue('bar'));
                $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelper->expects($this->any())->method('getPropertyValue')->will($this->returnValue('bar'));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
index c6e59c2..4793f63 100644 (file)
@@ -50,7 +50,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
        public function selectCorrectlySetsTagName() {
                $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('setTagName'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('select');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'options' => array()
@@ -72,7 +72,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="value1">label1</option>' . chr(10) . '<option value="value2" selected="selected">label2</option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'options' => array(
@@ -98,7 +98,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value=""></option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'options' => array(),
@@ -121,7 +121,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="value3">label3</option>' . chr(10) . '<option value="value1">label1</option>' . chr(10) . '<option value="value2" selected="selected">label2</option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'options' => array(
@@ -148,7 +148,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="value1">label1</option>' . chr(10) . '<option value="value2" selected="selected">label2</option>' . chr(10) . '<option value="value3">label3</option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'options' => array(
@@ -177,7 +177,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->exactly(3))->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="value1" selected="selected">label1</option>' . chr(10) . '<option value="value2">label2</option>' . chr(10) . '<option value="value3" selected="selected">label3</option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'options' => array(
@@ -214,7 +214,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="1">Ingmar</option>' . chr(10) . '<option value="2" selected="selected">Sebastian</option>' . chr(10) . '<option value="3">Robert</option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $user_is = new Tx_Fluid_ViewHelpers_Fixtures_UserDomainClass(1, 'Ingmar', 'Schlecht');
                $user_sk = new Tx_Fluid_ViewHelpers_Fixtures_UserDomainClass(2, 'Sebastian', 'Kurfuerst');
@@ -248,7 +248,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->exactly(3))->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="1" selected="selected">Schlecht</option>' . chr(10) . '<option value="2">Kurfuerst</option>' . chr(10) . '<option value="3" selected="selected">Lemke</option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $user_is = new Tx_Fluid_ViewHelpers_Fixtures_UserDomainClass(1, 'Ingmar', 'Schlecht');
                $user_sk = new Tx_Fluid_ViewHelpers_Fixtures_UserDomainClass(2, 'Sebastian', 'Kurfuerst');
@@ -286,7 +286,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="fakeUID">fakeUID</option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $user = new Tx_Fluid_ViewHelpers_Fixtures_UserDomainClass(1, 'Ingmar', 'Schlecht');
 
@@ -316,7 +316,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="fakeUID">toStringResult</option>' . chr(10));
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $user = $this->getMock('Tx_Fluid_ViewHelpers_Fixtures_UserDomainClass', array('__toString'), array(1, 'Ingmar', 'Schlecht'));
                $user->expects($this->atLeastOnce())->method('__toString')->will($this->returnValue('toStringResult'));
@@ -347,7 +347,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
                $this->viewHelper->injectPersistenceManager($mockPersistenceManager);
 
                $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute', 'setContent', 'render'), array(), '', FALSE);
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $user = new Tx_Fluid_ViewHelpers_Fixtures_UserDomainClass(1, 'Ingmar', 'Schlecht');
 
@@ -384,7 +384,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
        public function allOptionsAreSelectedIfSelectAllIsTrue() {
                $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute', 'setContent', 'render'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="value1" selected="selected">label1</option>' . chr(10) . '<option value="value2" selected="selected">label2</option>' . chr(10) . '<option value="value3" selected="selected">label3</option>' . chr(10));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'options' => array(
@@ -409,7 +409,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SelectViewHelperTest extends Tx_Fluid
        public function selectAllHasNoEffectIfValueIsSet() {
                $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('addAttribute', 'setContent', 'render'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setContent')->with('<option value="value1" selected="selected">label1</option>' . chr(10) . '<option value="value2" selected="selected">label2</option>' . chr(10) . '<option value="value3">label3</option>' . chr(10));
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'options' => array(
index b227999..5262e0b 100644 (file)
@@ -36,7 +36,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SubmitViewHelperTest extends Tx_Fluid
 
        public function setUp() {
                parent::setUp();
-               $this->viewHelper = new Tx_Fluid_ViewHelpers_Form_SubmitViewHelper();
+               $this->viewHelper = $this->getAccessibleMock('Tx_Fluid_ViewHelpers_Form_SubmitViewHelper', array('dummy'));
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
                $this->viewHelper->initializeArguments();
        }
@@ -50,7 +50,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_SubmitViewHelperTest extends Tx_Fluid
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('input');
                $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('type', 'submit');
 
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
index 9fb4c1a..053744e 100644 (file)
@@ -50,7 +50,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_TextareaViewHelperTest extends Tx_Flu
        public function renderCorrectlySetsTagName() {
                $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('setTagName'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('textarea');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -67,7 +67,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_TextareaViewHelperTest extends Tx_Flu
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('NameOfTextarea');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('Current value');
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'name' => 'NameOfTextarea',
@@ -99,7 +99,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_TextareaViewHelperTest extends Tx_Flu
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('NameOfTextarea');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('some &lt;tag&gt; &amp; &quot;quotes&quot;');
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'name' => 'NameOfTextarea',
index d2559f0..f2c3fc2 100644 (file)
@@ -50,7 +50,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_TextboxViewHelperTest extends Tx_Flui
        public function renderCorrectlySetsTagName() {
                $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('setTagName'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('input');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -68,7 +68,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_TextboxViewHelperTest extends Tx_Flui
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('NameOfTextbox');
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('value', 'Current value');
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'name' => 'NameOfTextbox',
index 3178c5d..3103e3d 100644 (file)
@@ -50,7 +50,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_UploadViewHelperTest extends Tx_Fluid
        public function renderCorrectlySetsTagName() {
                $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('setTagName'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('input');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
                $this->viewHelper->setArguments(new Tx_Fluid_Core_ViewHelper_Arguments(array()));
 
                $this->viewHelper->initialize();
@@ -68,7 +68,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_UploadViewHelperTest extends Tx_Fluid
                $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('name', 'someName');
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('someName');
                $mockTagBuilder->expects($this->once())->method('render');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $arguments = new Tx_Fluid_Core_ViewHelper_Arguments(array(
                        'name' => 'someName',
index 0638230..1ad4fe3 100644 (file)
@@ -202,12 +202,14 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_FormViewHelperTest extends Tx_Fluid_ViewHe
         * @test
         * @author Bastian Waidelich <bastian@typo3.org>
         */
-       public function renderAddsNoFieldNamePrefixToTemplateVariableContainerIfNoPrefixIsSpecified() {
-               $expectedPrefix = '';
+       public function renderAddsDefaultFieldNamePrefixToTemplateVariableContainerIfNoPrefixIsSpecified() {
+               $expectedPrefix = 'tx_someextension_someplugin';
 
                $viewHelper = $this->getAccessibleMock('Tx_Fluid_ViewHelpers_FormViewHelper', array('renderChildren', 'renderHiddenIdentityField', 'renderHiddenReferrerFields', 'renderRequestHashField', 'addFormFieldNamesToViewHelperVariableContainer', 'removeFormFieldNamesFromViewHelperVariableContainer'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($viewHelper);
 
+               $viewHelper->setArguments(new Tx_Fluid_Core_ViewHelper_Arguments(array('extensionName' => 'SomeExtension', 'pluginName' => 'SomePlugin')));
+
                $this->viewHelperVariableContainer->expects($this->once())->method('add')->with('Tx_Fluid_ViewHelpers_FormViewHelper', 'fieldNamePrefix', $expectedPrefix);
                $this->viewHelperVariableContainer->expects($this->once())->method('remove')->with('Tx_Fluid_ViewHelpers_FormViewHelper', 'fieldNamePrefix');
                $viewHelper->render();
index e211ccb..cb419d5 100644 (file)
@@ -22,7 +22,7 @@
 
 /**
  */
-class Tx_Fluid_Tests_Unit_ViewHelpers_Format_CropViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_ViewHelpers_Format_CropViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * var Tx_Fluid_ViewHelpers_Format_CropViewHelper
index 475589a..fce10e1 100644 (file)
@@ -22,7 +22,7 @@
 
 /**
  */
-class Tx_Fluid_Tests_Unit_ViewHelpers_Format_CurrencyViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_ViewHelpers_Format_CurrencyViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index 94811f5..c1c429a 100644 (file)
@@ -22,7 +22,7 @@
 
 /**
  */
-class Tx_Fluid_Tests_Unit_ViewHelpers_Format_DateViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_ViewHelpers_Format_DateViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index fb8d040..403b766 100644 (file)
@@ -22,7 +22,7 @@
 
 /**
  */
-class Tx_Fluid_Tests_Unit_ViewHelpers_Format_Nl2brViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_ViewHelpers_Format_Nl2brViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index 6a8da58..2759580 100644 (file)
@@ -22,7 +22,7 @@
 
 /**
  */
-class Tx_Fluid_Tests_Unit_ViewHelpers_Format_NumberViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_ViewHelpers_Format_NumberViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index 9c66971..a7d6482 100644 (file)
@@ -22,7 +22,7 @@
 
 /**
  */
-class Tx_Fluid_Tests_Unit_ViewHelpers_Format_PaddingViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_ViewHelpers_Format_PaddingViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
index 3f83a3f..dda2c25 100644 (file)
@@ -22,7 +22,7 @@
 
 /**
  */
-class Tx_Fluid_Tests_Unit_ViewHelpers_Format_PrintfViewHelperTest extends Tx_Extbase_BaseTestCase {
+class Tx_Fluid_Tests_Unit_ViewHelpers_Format_PrintfViewHelperTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @test
@@ -44,6 +44,6 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Format_PrintfViewHelperTest extends Tx_Ext
                $viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('%2$s %1$d %3$s %2$s'));
                $actualResult = $viewHelper->render(array(123, 'foo', 'bar'));
                $this->assertEquals('foo 123 bar foo', $actualResult);
-       }       
+       }
 }
 ?>
\ No newline at end of file
index 9e00e81..a33b330 100644 (file)
@@ -56,7 +56,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Link_EmailViewHelperTest extends Tx_Fluid_
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('a');
                $mockTagBuilder->expects($this->once())->method('addAttribute')->with('href', 'mailto:some@email.tld');
                $mockTagBuilder->expects($this->once())->method('setContent')->with('some content');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue('some content'));
 
@@ -73,7 +73,7 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Link_EmailViewHelperTest extends Tx_Fluid_
 
                $mockTagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder', array('setTagName', 'addAttribute', 'setContent'));
                $mockTagBuilder->expects($this->once())->method('setContent')->with('some@email.tld');
-               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+               $this->viewHelper->_set('tag', $mockTagBuilder);
 
                $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue(NULL));
 
diff --git a/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Persistence/IdentityViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Persistence/IdentityViewHelperTest.php
deleted file mode 100644 (file)
index c6d7fd8..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-/*                                                                        *
- * This script belongs to the FLOW3 package "Fluid".                      *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License as published by the *
- * Free Software Foundation, either version 3 of the License, or (at your *
- * option) any later version.                                             *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-require_once(dirname(__FILE__) . '/../ViewHelperBaseTestcase.php');
-
-/**
- * Testcase for IdentityViewHelper
- *
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
- */
-class Tx_Fluid_Tests_Unit_ViewHelpers_Persistence_IdentityViewHelperTest extends Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase {
-
-       /**
-        * @test
-        * @author Christopher Hlubek <hlubek@networkteam.com>
-        */
-       public function renderGetsIdentityForObjectFromPersistenceManager() {
-               $mockPersistenceManager = $this->getMock('Tx_Extbase_Persistence_ManagerInterface');
-
-               $viewHelper = $this->getAccessibleMock('Tx_Fluid_ViewHelpers_Persistence_IdentityViewHelper', array('dummy'), array(), '', FALSE);
-               $this->injectDependenciesIntoViewHelper($viewHelper);
-               $viewHelper->injectPersistenceManager($mockPersistenceManager);
-
-               $object = new stdClass();
-
-               $mockPersistenceManager->expects($this->atLeastOnce())->method('getIdentifierByObject')->with($object)->will($this->returnValue('6f487e40-4483-11de-8a39-0800200c9a66'));
-
-               $output = $viewHelper->render($object);
-
-               $this->assertEquals('6f487e40-4483-11de-8a39-0800200c9a66', $output, 'Identity is rendered as is');
-       }
-
-       /**
-        * @test
-        * @author Christopher Hlubek <hlubek@networkteam.com>
-        */
-       public function renderOutputsEmptyStringForNullIdentity() {
-               $mockPersistenceManager = $this->getMock('Tx_Extbase_Persistence_ManagerInterface');
-
-               $viewHelper = $this->getAccessibleMock('Tx_Fluid_ViewHelpers_Persistence_IdentityViewHelper', array('dummy'), array(), '', FALSE);
-               $this->injectDependenciesIntoViewHelper($viewHelper);
-               $viewHelper->injectPersistenceManager($mockPersistenceManager);
-
-               $object = new stdClass();
-
-               $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue(NULL));
-
-               $output = $viewHelper->render($object);
-
-               $this->assertEquals('', $output, 'NULL Identity is rendered as empty string');
-       }
-}
-
-?>
\ No newline at end of file
index 50c05db..4421db5 100644 (file)
@@ -22,7 +22,7 @@
 
 /**
  */
-abstract class Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase extends Tx_Extbase_BaseTestCase {
+abstract class Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase extends Tx_Extbase_Tests_Unit_BaseTestCase {
 
        /**
         * @var Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer