[TASK] Sync TYPO3 CMS Fluid with Flow Fluid 1.1 (part3)
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Sun, 3 Mar 2013 21:24:06 +0000 (22:24 +0100)
committerMarc Bastian Heinrichs <typo3@mbh-software.de>
Sun, 3 Mar 2013 21:25:41 +0000 (22:25 +0100)
This is the third part of a backport fluid from Flow.
It contains unit tests.

Change-Id: I9990607d95387b3635a2aaebfc49993f85be5bb7
Releases: 6.1
Resolves: #44819
Reviewed-on: https://review.typo3.org/18192
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
70 files changed:
typo3/sysext/fluid/Tests/Unit/Core/Parser/Fixtures/ChildNodeAccessFacetViewHelper.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/Fixtures/PostParseFacetViewHelper.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/Fixtures/TemplateParserTestFixture01-shorthand-split.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/Fixtures/TemplateParserTestFixture06-split.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/Fixtures/TemplateParserTestFixture06.html
typo3/sysext/fluid/Tests/Unit/Core/Parser/Fixtures/TemplateParserTestFixture14-split.php
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/BooleanNodeTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/TextNodeTest.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/ViewHelper/AbstractConditionViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractTagBasedViewHelperTest.php
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
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/TemplateVariableContainerTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/ViewHelperVariableContainerTest.php
typo3/sysext/fluid/Tests/Unit/View/AbstractTemplateViewTest.php
typo3/sysext/fluid/Tests/Unit/View/Fixtures/LayoutFixture.html
typo3/sysext/fluid/Tests/Unit/View/Fixtures/TemplateViewFixture.php
typo3/sysext/fluid/Tests/Unit/View/Fixtures/TemplateViewSectionFixture.html
typo3/sysext/fluid/Tests/Unit/View/Fixtures/TransparentSyntaxTreeNode.php
typo3/sysext/fluid/Tests/Unit/View/TemplateViewTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/AliasViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/BaseViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/CountViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/CycleViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ElseViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Fixtures/ConstraintSyntaxTreeNode.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Fixtures/IfFixture.html
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Fixtures/IfThenElseFixture.html
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php [new file with mode: 0644]
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ForViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/AbstractFormFieldViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/AbstractFormViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/ButtonViewHelperTest.php [new file with mode: 0644]
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/CheckboxViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/Fixtures/EmptySyntaxTreeNode.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/Fixtures/Fixture_UserDomainClass.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/PasswordViewHelperTest.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/TextfieldViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/UploadViewHelperTest.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/HtmlentitiesDecodeViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/HtmlentitiesViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/HtmlspecialcharsViewHelperTest.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/Format/RawViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/StripTagsViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/UrlencodeViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/GroupedForViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/IfViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/ExternalViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/RenderViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ThenViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Uri/ExternalViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php

index eead342..a715400 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Core\Parser\Fixtures;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Core\Parser\Fixtures;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Test fixture for the child node access facet.
  */
index 07842f3..59d89a2 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Core\Parser\Fixtures;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Core\Parser\Fixtures;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Enter description here...
  */
index 74a7905..e97019b 100644 (file)
@@ -1,3 +1,5 @@
 <?php
-return array('{namespace foo=Tx_Fluid_ViewHelpers}<foo:format.nl2br><foo:format.number decimals="1">{number}</foo:format.number></foo:format.nl2br>');
+
+return array('{namespace foo=TYPO3\CMS\Fluid\ViewHelpers}<foo:format.nl2br><foo:format.number decimals="1">{number}</foo:format.number></foo:format.nl2br>');
+
 ?>
\ No newline at end of file
index 3d5c9b6..bfd3189 100644 (file)
@@ -1 +1 @@
-{namespace foo=Tx_Fluid_ViewHelpers}<foo:format.nl2br><foo:format.number decimals="1">{number}</foo:format.number></foo:format.nl2br>
\ No newline at end of file
+{namespace foo=TYPO3\CMS\Fluid\ViewHelpers}<foo:format.nl2br><foo:format.number decimals="1">{number}</foo:format.number></foo:format.nl2br>
\ No newline at end of file
index 279f3cc..1a69b7a 100644 (file)
@@ -1,7 +1,9 @@
 <?php
+
 return array(
        '<f:format.printf arguments="{number : 362525200}">',
        '%.3e',
        '</f:format.printf>'
 );
+
 ?>
\ No newline at end of file
index e715c13..d03ac55 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\Interceptor;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\Interceptor;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for Interceptor\Escape
  */
@@ -49,6 +50,7 @@ class EscapeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $interceptorPosition = \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER;
                $this->mockViewHelper->expects($this->once())->method('isEscapingInterceptorEnabled')->will($this->returnValue(TRUE));
                $this->mockNode->expects($this->once())->method('getUninitializedViewHelper')->will($this->returnValue($this->mockViewHelper));
+
                $this->assertTrue($this->escapeInterceptor->_get('interceptorEnabled'));
                $this->escapeInterceptor->process($this->mockNode, $interceptorPosition, $this->mockParsingState);
                $this->assertTrue($this->escapeInterceptor->_get('interceptorEnabled'));
@@ -61,6 +63,7 @@ class EscapeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $interceptorPosition = \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER;
                $this->mockViewHelper->expects($this->once())->method('isEscapingInterceptorEnabled')->will($this->returnValue(FALSE));
                $this->mockNode->expects($this->once())->method('getUninitializedViewHelper')->will($this->returnValue($this->mockViewHelper));
+
                $this->assertTrue($this->escapeInterceptor->_get('interceptorEnabled'));
                $this->escapeInterceptor->process($this->mockNode, $interceptorPosition, $this->mockParsingState);
                $this->assertFalse($this->escapeInterceptor->_get('interceptorEnabled'));
@@ -71,8 +74,10 @@ class EscapeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function processReenablesEscapingInterceptorOnClosingViewHelperTagIfItWasDisabledBefore() {
                $interceptorPosition = \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER;
+
                $this->escapeInterceptor->_set('interceptorEnabled', FALSE);
                $this->escapeInterceptor->_set('viewHelperNodesWhichDisableTheInterceptor', array($this->mockNode));
+
                $this->escapeInterceptor->process($this->mockNode, $interceptorPosition, $this->mockParsingState);
                $this->assertTrue($this->escapeInterceptor->_get('interceptorEnabled'));
        }
@@ -80,7 +85,7 @@ class EscapeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @test
         */
-       public function processWrapsCurrentViewHelperInHtmlentitiesViewHelperOnObjectAccessor() {
+       public function processWrapsCurrentViewHelperInHtmlspecialcharsViewHelperOnObjectAccessor() {
                $interceptorPosition = \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OBJECTACCESSOR;
                $mockNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', array(), array(), '', FALSE);
                $mockEscapeViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\HtmlspecialcharsViewHelper');
@@ -88,6 +93,7 @@ class EscapeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\HtmlspecialcharsViewHelper')->will($this->returnValue($mockEscapeViewHelper));
                $mockObjectManager->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', $mockEscapeViewHelper, array('value' => $mockNode))->will($this->returnValue($this->mockNode));
                $this->escapeInterceptor->injectObjectManager($mockObjectManager);
+
                $actualResult = $this->escapeInterceptor->process($mockNode, $interceptorPosition, $this->mockParsingState);
                $this->assertSame($this->mockNode, $actualResult);
        }
index 0860b15..d5c57d2 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,8 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for ParsingState
+ *
  */
 class ParsingStateTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
@@ -54,6 +56,7 @@ class ParsingStateTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function renderCallsTheRightMethodsOnTheRootNode() {
                $renderingContext = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Rendering\\RenderingContextInterface');
+
                $rootNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode');
                $rootNode->expects($this->once())->method('evaluate')->with($renderingContext)->will($this->returnValue('T3DD09 Rock!'));
                $this->parsingState->setRootNode($rootNode);
index 6f350fd..a1b0829 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * An AbstractNode Test
  */
@@ -23,7 +24,9 @@ class AbstractNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        public function setUp() {
                $this->renderingContext = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Rendering\\RenderingContext', array(), array(), '', FALSE);
+
                $this->abstractNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\AbstractNode', array('evaluate'));
+
                $this->childNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\AbstractNode');
                $this->abstractNode->addChildNode($this->childNode);
        }
index fc8f8b3..5a3f846 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for ViewHelperNode's evaluateBooleanExpression()
  */
@@ -39,6 +40,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function havingMoreThanThreeElementsInTheSyntaxTreeThrowsException() {
                $rootNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode');
                $rootNode->expects($this->once())->method('getChildNodes')->will($this->returnValue(array(1, 2, 3, 4)));
+
                new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
        }
 
@@ -50,6 +52,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('5'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('=='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('5'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -62,6 +65,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('5'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('=='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('3'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertFalse($booleanNode->evaluate($this->renderingContext));
        }
@@ -74,6 +78,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('5'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('!='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('5'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertFalse($booleanNode->evaluate($this->renderingContext));
        }
@@ -86,6 +91,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('5'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('!='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('3'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -98,6 +104,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('43'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('%'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('2'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -110,6 +117,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('42'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('%'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('2'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertFalse($booleanNode->evaluate($this->renderingContext));
        }
@@ -122,6 +130,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('>'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('9'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -134,6 +143,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('>'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertFalse($booleanNode->evaluate($this->renderingContext));
        }
@@ -146,6 +156,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('>='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('9'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -158,6 +169,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('>='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -170,6 +182,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('>='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('11'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertFalse($booleanNode->evaluate($this->renderingContext));
        }
@@ -182,6 +195,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('9'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('<'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -194,6 +208,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('<'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertFalse($booleanNode->evaluate($this->renderingContext));
        }
@@ -206,6 +221,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('9'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('<='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -218,6 +234,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('<='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -230,6 +247,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('11'));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('<='));
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('10'));
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertFalse($booleanNode->evaluate($this->renderingContext));
        }
@@ -327,14 +345,19 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function objectsAreComparedStrictly() {
                $object1 = new \stdClass();
                $object2 = new \stdClass();
+
                $rootNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\RootNode();
+
                $object1Node = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', array('evaluate'), array('foo'));
                $object1Node->expects($this->any())->method('evaluate')->will($this->returnValue($object1));
+
                $object2Node = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', array('evaluate'), array('foo'));
                $object2Node->expects($this->any())->method('evaluate')->will($this->returnValue($object2));
+
                $rootNode->addChildNode($object1Node);
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('=='));
                $rootNode->addChildNode($object2Node);
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertFalse($booleanNode->evaluate($this->renderingContext));
        }
@@ -345,14 +368,19 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function objectsAreComparedStrictlyInUnequalComparison() {
                $object1 = new \stdClass();
                $object2 = new \stdClass();
+
                $rootNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\RootNode();
+
                $object1Node = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', array('evaluate'), array('foo'));
                $object1Node->expects($this->any())->method('evaluate')->will($this->returnValue($object1));
+
                $object2Node = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', array('evaluate'), array('foo'));
                $object2Node->expects($this->any())->method('evaluate')->will($this->returnValue($object2));
+
                $rootNode->addChildNode($object1Node);
                $rootNode->addChildNode(new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('!='));
                $rootNode->addChildNode($object2Node);
+
                $booleanNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode($rootNode);
                $this->assertTrue($booleanNode->evaluate($this->renderingContext));
        }
@@ -372,6 +400,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->assertFalse(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(''));
                $this->assertFalse(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean('false'));
                $this->assertFalse(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean('FALSE'));
+
                $this->assertTrue(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean('true'));
                $this->assertTrue(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean('TRUE'));
        }
@@ -384,6 +413,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->assertFalse(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(-1));
                $this->assertFalse(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean('-1'));
                $this->assertFalse(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(-0.5));
+
                $this->assertTrue(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(1));
                $this->assertTrue(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(0.5));
        }
@@ -393,6 +423,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function convertToBooleanProperlyConvertsValuesOfTypeArray() {
                $this->assertFalse(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(array()));
+
                $this->assertTrue(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(array('foo')));
                $this->assertTrue(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(array('foo' => 'bar')));
        }
@@ -402,6 +433,7 @@ class BooleanNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function convertToBooleanProperlyConvertsObjects() {
                $this->assertFalse(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(NULL));
+
                $this->assertTrue(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode::convertToBoolean(new \stdClass()));
        }
 }
index 74f33ea..b541824 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for TextNode
  */
index 1a5bd44..ed9f26b 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,11 +10,12 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 require_once dirname(__FILE__) . '/../Fixtures/ChildNodeAccessFacetViewHelper.php';
 require_once dirname(__FILE__) . '/../../Fixtures/TestViewHelper.php';
 
 /**
- * Testcase for [insert classname here]
+ * Testcase for \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode
  */
 class ViewHelperNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
@@ -54,12 +55,16 @@ class ViewHelperNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function setUp() {
                $this->renderingContext = new \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext();
+
                $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $this->renderingContext->injectObjectManager($this->mockObjectManager);
+
                $this->templateVariableContainer = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TemplateVariableContainer');
                $this->renderingContext->injectTemplateVariableContainer($this->templateVariableContainer);
+
                $this->controllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
                $this->renderingContext->setControllerContext($this->controllerContext);
+
                $this->viewHelperVariableContainer = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer');
                $this->renderingContext->injectViewHelperVariableContainer($this->viewHelperVariableContainer);
        }
@@ -71,6 +76,7 @@ class ViewHelperNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $viewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper');
                $arguments = array('foo' => 'bar');
                $viewHelperNode = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array('dummy'), array($viewHelper, $arguments));
+
                $this->assertEquals(get_class($viewHelper), $viewHelperNode->getViewHelperClassName());
                $this->assertEquals($arguments, $viewHelperNode->_get('arguments'));
        }
@@ -80,10 +86,14 @@ class ViewHelperNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function childNodeAccessFacetWorksAsExpected() {
                $childNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\TextNode', array(), array('foo'));
+
                $mockViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\Fixtures\\ChildNodeAccessFacetViewHelper', array('setChildNodes', 'initializeArguments', 'render', 'prepareArguments'));
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode($mockViewHelper, array());
                $viewHelperNode->addChildNode($childNode);
+
                $mockViewHelper->expects($this->once())->method('setChildNodes')->with($this->equalTo(array($childNode)));
+
                $viewHelperNode->evaluate($this->renderingContext);
        }
 
@@ -93,7 +103,9 @@ class ViewHelperNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function initializeArgumentsAndRenderIsCalledByViewHelperNode() {
                $mockViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('initializeArgumentsAndRender', 'prepareArguments'));
                $mockViewHelper->expects($this->once())->method('initializeArgumentsAndRender');
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode($mockViewHelper, array());
+
                $viewHelperNode->evaluate($this->renderingContext);
        }
 
@@ -106,13 +118,16 @@ class ViewHelperNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        'param1' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param1', 'string', 'Hallo', TRUE, NULL, TRUE),
                        'param2' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param2', 'string', 'Hallo', TRUE, NULL, TRUE)
                );
+
                $mockViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('initializeArgumentsAndRender', 'prepareArguments'));
                $mockViewHelper->expects($this->any())->method('prepareArguments')->will($this->returnValue($arguments));
                $mockViewHelper->expects($this->once())->method('initializeArgumentsAndRender');
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode($mockViewHelper, array(
                        'param2' => new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('b'),
                        'param1' => new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('a')
                ));
+
                $viewHelperNode->evaluate($this->renderingContext);
        }
 
@@ -122,7 +137,9 @@ class ViewHelperNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function evaluateMethodPassesRenderingContextToViewHelper() {
                $mockViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'validateArguments', 'prepareArguments', 'setRenderingContext'));
                $mockViewHelper->expects($this->once())->method('setRenderingContext')->with($this->renderingContext);
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode($mockViewHelper, array());
+
                $viewHelperNode->evaluate($this->renderingContext);
        }
 
@@ -132,7 +149,9 @@ class ViewHelperNodeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function multipleEvaluateCallsShareTheSameViewHelperInstance() {
                $mockViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'validateArguments', 'prepareArguments', 'setViewHelperVariableContainer'));
                $mockViewHelper->expects($this->any())->method('render')->will($this->returnValue('String'));
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode($mockViewHelper, array());
+
                $viewHelperNode->evaluate($this->renderingContext);
                $viewHelperNode->evaluate($this->renderingContext);
        }
index b4aaac5..4190ed9 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for Regular expressions in parser
  */
@@ -44,28 +45,39 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
         */
        public function testSPLIT_PATTERN_DYNAMICTAGS() {
                $pattern = $this->insertNamespaceIntoRegularExpression(\TYPO3\CMS\Fluid\Core\Parser\TemplateParser::$SPLIT_PATTERN_TEMPLATE_DYNAMICTAGS, array('typo3', 't3', 'f'));
+
                $source = '<html><head> <f:a.testing /> <f:blablubb> {testing}</f4:blz> </t3:hi.jo>';
                $expected = array('<html><head> ', '<f:a.testing />', ' ', '<f:blablubb>', ' {testing}</f4:blz> ', '</t3:hi.jo>');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly with simple tags.');
+
                $source = 'hi<f:testing attribute="Hallo>{yep}" nested:attribute="jup" />ja';
                $expected = array('hi', '<f:testing attribute="Hallo>{yep}" nested:attribute="jup" />', 'ja');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly with  > inside an attribute.');
+
                $source = 'hi<f:testing attribute="Hallo\\"{yep}" nested:attribute="jup" />ja';
                $expected = array('hi', '<f:testing attribute="Hallo\\"{yep}" nested:attribute="jup" />', 'ja');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly if a " is inside a double-quoted string.');
+
                $source = 'hi<f:testing attribute=\'Hallo>{yep}\' nested:attribute="jup" />ja';
                $expected = array('hi', '<f:testing attribute=\'Hallo>{yep}\' nested:attribute="jup" />', 'ja');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly with single quotes as attribute delimiters.');
+
                $source = 'hi<f:testing attribute=\'Hallo\\\'{yep}\' nested:attribute="jup" />ja';
                $expected = array('hi', '<f:testing attribute=\'Hallo\\\'{yep}\' nested:attribute="jup" />', 'ja');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly if \' is inside a single-quoted attribute.');
+
                $source = 'Hallo <f:testing><![CDATA[<f:notparsed>]]></f:testing>';
                $expected = array('Hallo ', '<f:testing>', '<![CDATA[<f:notparsed>]]>', '</f:testing>');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly if there is a CDATA section the parser should ignore.');
-               $veryLongViewHelper = '<f:form enctype="multipart/form-data" onsubmit="void(0)" onreset="void(0)" action="someAction" arguments="{arg1: \'val1\', arg2: \'val2\'}" controller="someController" package="YourCompanyName.somePackage" subpackage="YourCompanyName.someSubpackage" section="someSection" format="txt" additionalParams="{param1: \'val1\', param2: \'val2\'}" absolute="true" addQueryString="true" argumentsToBeExcludedFromQueryString="{0: \'foo\'}" />';
+
+               $veryLongViewHelper ='<f:form enctype="multipart/form-data" onsubmit="void(0)" onreset="void(0)" action="someAction" arguments="{arg1: \'val1\', arg2: \'val2\'}" controller="someController" package="YourCompanyName.somePackage" subpackage="YourCompanyName.someSubpackage" section="someSection" format="txt" additionalParams="{param1: \'val1\', param2: \'val2\'}" absolute="true" addQueryString="true" argumentsToBeExcludedFromQueryString="{0: \'foo\'}" />';
                $source = $veryLongViewHelper . 'Begin' . $veryLongViewHelper . 'End';
                $expected = array($veryLongViewHelper, 'Begin', $veryLongViewHelper, 'End');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly if the VH has lots of arguments.');
+
+               $source = '<f:a.testing data-bar="foo"> <f:a.testing>';
+               $expected = array('<f:a.testing data-bar="foo">', ' ', '<f:a.testing>');
+               $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly with data- attribute.');
        }
 
        /**
@@ -87,6 +99,23 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                );
                preg_match($pattern, $source, $matches);
                $this->assertEquals($expected, $matches, 'The SCAN_PATTERN_DYNAMICTAG does not match correctly.');
+
+               $pattern = $this->insertNamespaceIntoRegularExpression(\TYPO3\CMS\Fluid\Core\Parser\TemplateParser::$SCAN_PATTERN_TEMPLATE_VIEWHELPERTAG, array('f'));
+               $source = '<f:crop data-attribute="Hallo">';
+               $expected = array (
+                       0 => '<f:crop data-attribute="Hallo">',
+                       'NamespaceIdentifier' => 'f',
+                       1 => 'f',
+                       'MethodIdentifier' => 'crop',
+                       2 => 'crop',
+                       'Attributes' => ' data-attribute="Hallo"',
+                       3 => ' data-attribute="Hallo"',
+                       'Selfclosing' => '',
+                       4 => ''
+               );
+               preg_match($pattern, $source, $matches);
+               $this->assertEquals($expected, $matches, 'The SCAN_PATTERN_DYNAMICTAG does not match correctly with data- attributes.');
+
                $source = '<f:base />';
                $expected = array(
                        0 => '<f:base />',
@@ -101,6 +130,7 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                );
                preg_match($pattern, $source, $matches);
                $this->assertEquals($expected, $matches, 'The SCAN_PATTERN_DYNAMICTAG does not match correctly when there is a space before the self-closing tag.');
+
                $source = '<f:crop attribute="Ha\\"llo"/>';
                $expected = array(
                        0 => '<f:crop attribute="Ha\\"llo"/>',
@@ -115,6 +145,7 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                );
                preg_match($pattern, $source, $matches);
                $this->assertEquals($expected, $matches, 'The SCAN_PATTERN_DYNAMICTAG does not match correctly with self-closing tags.');
+
                $source = '<f:link.uriTo complex:attribute="Ha>llo" a="b" c=\'d\'/>';
                $expected = array(
                        0 => '<f:link.uriTo complex:attribute="Ha>llo" a="b" c=\'d\'/>',
@@ -146,8 +177,9 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
         */
        public function testSPLIT_PATTERN_TAGARGUMENTS() {
                $pattern = \TYPO3\CMS\Fluid\Core\Parser\TemplateParser::$SPLIT_PATTERN_TAGARGUMENTS;
-               $source = ' test="Hallo" argument:post="\'Web" other=\'Single"Quoted\'';
-               $this->assertEquals(preg_match_all($pattern, $source, $matches, PREG_SET_ORDER), 3, 'The SPLIT_PATTERN_TAGARGUMENTS does not match correctly.');
+               $source = ' test="Hallo" argument:post="\'Web" other=\'Single"Quoted\' data-foo="bar"';
+               $this->assertEquals(preg_match_all($pattern, $source, $matches, PREG_SET_ORDER), 4, 'The SPLIT_PATTERN_TAGARGUMENTS does not match correctly.');
+               $this->assertEquals('data-foo', $matches[3]['Argument']);
        }
 
        /**
@@ -155,24 +187,32 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
         */
        public function testSPLIT_PATTERN_SHORTHANDSYNTAX() {
                $pattern = $this->insertNamespaceIntoRegularExpression(\TYPO3\CMS\Fluid\Core\Parser\TemplateParser::$SPLIT_PATTERN_SHORTHANDSYNTAX, array('f'));
+
                $source = 'some string{Object.bla}here as well';
                $expected = array('some string', '{Object.bla}', 'here as well');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with a simple example.');
+
                $source = 'some {}string\\{Object.bla}here as well';
-               $expected = array('some {}string\\', '{Object.bla}', 'here as well');
+               $expected = array('some {}string\\', '{Object.bla}','here as well');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example. (1)');
+
                $source = 'some {f:viewHelper()} as well';
                $expected = array('some ', '{f:viewHelper()}', ' as well');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example. (2)');
+
                $source = 'abc {f:for(arg1: post)} def';
                $expected = array('abc ', '{f:for(arg1: post)}', ' def');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example.(3)');
+
                $source = 'abc {bla.blubb->f:for(param:42)} def';
                $expected = array('abc ', '{bla.blubb->f:for(param:42)}', ' def');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example.(4)');
+
+
                $source = 'abc {f:for(bla:"post{{")} def';
                $expected = array('abc ', '{f:for(bla:"post{{")}', ' def');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example.(5)');
+
                $source = 'abc {f:for(param:"abc\\"abc")} def';
                $expected = array('abc ', '{f:for(param:"abc\\"abc")}', ' def');
                $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example.(6)');
@@ -183,6 +223,7 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
         */
        public function testSPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER() {
                $pattern = \TYPO3\CMS\Fluid\Core\Parser\TemplateParser::$SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER;
+
                $source = 'f:for(each: bla)';
                $expected = array(
                        0 => array(
@@ -197,6 +238,7 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                );
                preg_match_all($pattern, $source, $matches, PREG_SET_ORDER);
                $this->assertEquals($matches, $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER');
+
                $source = 'f:for(each: bla)->g:bla(a:"b\\"->(f:a()", cd: {a:b})';
                $expected = array(
                        0 => array(
@@ -237,6 +279,7 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                $this->assertEquals(preg_match($pattern, '{bla-blubb.recursive_value->f:for()->f:for()}'), 1, 'Object accessor not identified if there is a recursive ViewHelper inside!');
                $this->assertEquals(preg_match($pattern, '{f:for(arg1:arg1value, arg2: "bla\\"blubb")}'), 1, 'Object accessor not identified if there is an argument inside!');
                $this->assertEquals(preg_match($pattern, '{dash:value}'), 0, 'Object accessor identified, but was array!');
+               //$this->assertEquals(preg_match($pattern, '{}'), 0, 'Object accessor identified, and it was empty!');
        }
 
        /**
@@ -249,9 +292,11 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                $this->assertEquals(preg_match($pattern, '{a : 123}'), 1, 'Array syntax not identified when a number is passed as argument!');
                $this->assertEquals(preg_match($pattern, '{a:"String"}'), 1, 'Array syntax not identified in case of a double quoted string!');
                $this->assertEquals(preg_match($pattern, '{a:\'String\'}'), 1, 'Array syntax not identified in case of a single quoted string!');
+
                $expected = '{a:{bla:{x:z}, b: a}}';
                preg_match($pattern, $expected, $match);
                $this->assertEquals($match[0], $expected, 'If nested arrays appear, the string is not parsed correctly.');
+
                $expected = '{a:"{bla{{}"}';
                preg_match($pattern, $expected, $match);
                $this->assertEquals($match[0], $expected, 'If nested strings with {} inside appear, the string is not parsed correctly.');
@@ -262,8 +307,10 @@ class TemplateParserPatternTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
         */
        public function testSPLIT_PATTERN_SHORTHANDSYNTAX_ARRAY_PARTS() {
                $pattern = \TYPO3\CMS\Fluid\Core\Parser\TemplateParser::$SPLIT_PATTERN_SHORTHANDSYNTAX_ARRAY_PARTS;
+
                $source = '{a: b, e: {c:d, e:f}}';
                preg_match_all($pattern, $source, $matches, PREG_SET_ORDER);
+
                $expected = array(
                        0 => array(
                                0 => 'a: b',
index c69f9d8..08cd328 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/Fixtures/PostParseFacetViewHelper.php';
+
+require_once(dirname(__FILE__) . '/Fixtures/PostParseFacetViewHelper.php');
 
 /**
  * Testcase for TemplateParser.
@@ -34,10 +35,77 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function extractNamespaceDefinitionsExtractsNamespacesCorrectly() {
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
-               $templateParser->_call('extractNamespaceDefinitions', ' \\{namespace f4=F7\\Rocks} {namespace f4=Tx_Fluid_Really}');
+               $templateParser->_call('extractNamespaceDefinitions', ' \\{namespace f4=F7\\Rocks} {namespace f4=TYPO3\Rocks\Really}');
+               $expected = array(
+                       'f' => 'TYPO3\CMS\Fluid\ViewHelpers',
+                       'f4' => 'TYPO3\Rocks\Really'
+               );
+               $this->assertEquals($expected, $templateParser->getNamespaces(), 'Namespaces do not match.');
+       }
+
+       /**
+        * @test
+        */
+       public function extractNamespaceDefinitionsExtractsXmlNamespacesCorrectly() {
+               $mockSettings = array(
+                       'namespaces' => array(
+                               'http://domain.tld/ns/my/viewhelpers' => 'My\Namespace',
+                               'http://otherdomain.tld/ns/other/viewhelpers' => 'My\Other\Namespace'
+                       )
+               );
+               $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+               $templateParser->injectSettings($mockSettings);
+               $templateParser->_call('extractNamespaceDefinitions', 'Some content <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f5="http://domain.tld/ns/my/viewhelpers"
+               xmlns:xyz="http://otherdomain.tld/ns/other/viewhelpers" />');
+               $expected = array(
+                       'f' => 'TYPO3\CMS\Fluid\ViewHelpers',
+                       'f5' => 'My\Namespace',
+                       'xyz' => 'My\Other\Namespace'
+               );
+               $this->assertEquals($expected, $templateParser->getNamespaces(), 'Namespaces do not match.');
+       }
+
+       /**
+        * @test
+        */
+       public function extractNamespaceDefinitionsResolveNamespacesWithDefaultPattern() {
+               $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+               $templateParser->_call('extractNamespaceDefinitions', '<xml xmlns="http://www.w3.org/1999/xhtml" xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers" />');
+               $expected = array(
+                       'f' => 'TYPO3\CMS\Fluid\ViewHelpers',
+                       'xyz' => 'Some\Package\ViewHelpers'
+               );
+               $this->assertEquals($expected, $templateParser->getNamespaces(), 'Namespaces do not match.');
+       }
+
+       /**
+        * @test
+        */
+       public function extractNamespaceDefinitionsSilentlySkipsXmlNamespaceDeclarationsThatCantBeResolved() {
+               $mockSettings = array(
+                       'namespaces' => array(
+                               'http://domain.tld/ns/my/viewhelpers' => 'My\Namespace'
+                       )
+               );
+               $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+               $templateParser->injectSettings($mockSettings);
+               $templateParser->_call('extractNamespaceDefinitions', '<xml xmlns="http://www.w3.org/1999/xhtml" xmlns:f5="http://domain.tld/ns/my/viewhelpers"
+               xmlns:xyz="http://otherdomain.tld/ns/other/viewhelpers" />');
                $expected = array(
                        'f' => 'TYPO3\CMS\Fluid\ViewHelpers',
-                       'f4' => 'Tx_Fluid_Really'
+                       'f5' => 'My\Namespace'
+               );
+               $this->assertEquals($expected, $templateParser->getNamespaces(), 'Namespaces do not match.');
+       }
+
+       /**
+        * @test
+        */
+       public function extractNamespaceDefinitionsSilentlySkipsXmlNamespaceDeclarationForTheDefaultFluidNamespace() {
+               $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+               $templateParser->_call('extractNamespaceDefinitions', '<foo xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://domain.tld/this/will/be/ignored" />');
+               $expected = array(
+                       'f' => 'TYPO3\CMS\Fluid\ViewHelpers'
                );
                $this->assertEquals($expected, $templateParser->getNamespaces(), 'Namespaces do not match.');
        }
@@ -48,7 +116,37 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function extractNamespaceDefinitionsThrowsExceptionIfNamespaceIsRedeclared() {
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
-               $templateParser->_call('extractNamespaceDefinitions', '{namespace typo3=Tx_Fluid_Blablubb} {namespace typo3= Tx_Fluid_Blu}');
+               $templateParser->_call('extractNamespaceDefinitions', '{namespace typo3=TYPO3\CMS\Fluid\Blablubb} {namespace typo3= TYPO3\Rocks\Blu}');
+       }
+
+       /**
+        * @test
+        * @expectedException \TYPO3\CMS\Fluid\Core\Parser\Exception
+        */
+       public function extractNamespaceDefinitionsThrowsExceptionIfXmlNamespaceIsRedeclaredAsFluidNamespace() {
+               $mockSettings = array(
+                       'namespaces' => array(
+                               'http://domain.tld/ns/my/viewhelpers' => 'My\Namespace'
+                       )
+               );
+               $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+               $templateParser->injectSettings($mockSettings);
+               $templateParser->_call('extractNamespaceDefinitions', '<foo xmlns="http://www.w3.org/1999/xhtml" xmlns:typo3="http://domain.tld/ns/my/viewhelpers" />{namespace typo3=TYPO3\CMS\Fluid\Blablubb}');
+       }
+
+       /**
+        * @test
+        * @expectedException \TYPO3\CMS\Fluid\Core\Parser\Exception
+        */
+       public function extractNamespaceDefinitionsThrowsExceptionIfFluidNamespaceIsRedeclaredAsXmlNamespace() {
+               $mockSettings = array(
+                       'namespaces' => array(
+                               'http://domain.tld/ns/my/viewhelpers' => 'My\Namespace'
+                       )
+               );
+               $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+               $templateParser->injectSettings($mockSettings);
+               $templateParser->_call('extractNamespaceDefinitions', '{namespace typo3=TYPO3\CMS\Fluid\Blablubb} <foo xmlns="http://www.w3.org/1999/xhtml" xmlns:typo3="http://domain.tld/ns/my/viewhelpers" />');
        }
 
        /**
@@ -72,15 +170,15 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        }
 
        /**
-
         */
        public function quotedStrings() {
                return array(
                        array('"no quotes here"', 'no quotes here'),
-                       array('\'no quotes here\'', 'no quotes here'),
-                       array('\'this "string" had \\\'quotes\\\' in it\'', 'this "string" had \'quotes\' in it'),
+                       array("'no quotes here'", 'no quotes here'),
+                       array("'this \"string\" had \\'quotes\\' in it'", 'this "string" had \'quotes\' in it'),
                        array('"this \\"string\\" had \'quotes\' in it"', 'this "string" had \'quotes\' in it'),
-                       array('"a weird \\"string\\" \'with\' *freaky* \\\\stuff', 'a weird "string" \'with\' *freaky* \\stuff')
+                       array('"a weird \"string\" \'with\' *freaky* \\\\stuff', 'a weird "string" \'with\' *freaky* \\stuff'),
+                       array('\'\\\'escaped quoted string in string\\\'\'', '\'escaped quoted string in string\'')
                );
        }
 
@@ -94,7 +192,6 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        }
 
        /**
-
         */
        public function templatesToSplit() {
                return array(
@@ -110,7 +207,7 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function splitTemplateAtDynamicTagsReturnsCorrectlySplitTemplate($templateName) {
                $template = file_get_contents(dirname(__FILE__) . '/Fixtures/' . $templateName . '.html', FILE_TEXT);
-               $expectedResult = require dirname(__FILE__) . '/Fixtures/' . $templateName . '-split.php';
+               $expectedResult = require(dirname(__FILE__) . '/Fixtures/' . $templateName . '-split.php');
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
                $this->assertSame($expectedResult, $templateParser->_call('splitTemplateAtDynamicTags', $template), 'Filed for ' . $templateName);
        }
@@ -120,15 +217,19 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function buildObjectTreeCreatesRootNodeAndSetsUpParsingState() {
                $mockRootNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode');
+
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('setRootNode')->with($mockRootNode);
                $mockState->expects($this->once())->method('pushNodeToStack')->with($mockRootNode);
                $mockState->expects($this->once())->method('countNodeStack')->will($this->returnValue(1));
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState')->will($this->returnValue($mockState));
                $mockObjectManager->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode')->will($this->returnValue($mockRootNode));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
                $templateParser->injectObjectManager($mockObjectManager);
+
                $templateParser->_call('buildObjectTree', array());
        }
 
@@ -138,13 +239,17 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function buildObjectTreeThrowsExceptionIfOpenTagsRemain() {
                $mockRootNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode');
+
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('countNodeStack')->will($this->returnValue(2));
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState')->will($this->returnValue($mockState));
                $mockObjectManager->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode')->will($this->returnValue($mockRootNode));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
                $templateParser->injectObjectManager($mockObjectManager);
+
                $templateParser->_call('buildObjectTree', array());
        }
 
@@ -158,6 +263,7 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState')->will($this->returnValue($mockState));
                $mockObjectManager->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode')->will($this->returnValue($mockRootNode));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('textHandler', 'openingViewHelperTagHandler', 'closingViewHelperTagHandler', 'textAndShorthandSyntaxHandler'));
                $templateParser->injectObjectManager($mockObjectManager);
                $templateParser->expects($this->at(0))->method('textAndShorthandSyntaxHandler')->with($mockState, 'The first part is simple');
@@ -166,7 +272,9 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $templateParser->expects($this->at(3))->method('textAndShorthandSyntaxHandler')->with($mockState, '%.3e');
                $templateParser->expects($this->at(4))->method('closingViewHelperTagHandler')->with($mockState, 'f', 'format.printf');
                $templateParser->expects($this->at(5))->method('textAndShorthandSyntaxHandler')->with($mockState, 'and here goes some {text} that could have {shorthand}');
+
                $splitTemplate = $templateParser->_call('splitTemplateAtDynamicTags', 'The first part is simple<![CDATA[<f:for each="{a: {a: 0, b: 2, c: 4}}" as="array"><f:for each="{array}" as="value">{value} </f:for>]]><f:format.printf arguments="{number : 362525200}">%.3e</f:format.printf>and here goes some {text} that could have {shorthand}');
+
                $templateParser->_call('buildObjectTree', $splitTemplate);
        }
 
@@ -176,9 +284,11 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function openingViewHelperTagHandlerDelegatesViewHelperInitialization() {
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->never())->method('popNodeFromStack');
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('parseArguments', 'initializeViewHelperAndAddItToStack'));
                $templateParser->expects($this->once())->method('parseArguments')->with(array('arguments'))->will($this->returnValue(array('parsedArguments')));
                $templateParser->expects($this->once())->method('initializeViewHelperAndAddItToStack')->with($mockState, 'namespaceIdentifier', 'methodIdentifier', array('parsedArguments'));
+
                $templateParser->_call('openingViewHelperTagHandler', $mockState, 'namespaceIdentifier', 'methodIdentifier', array('arguments'), FALSE);
        }
 
@@ -188,7 +298,9 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function openingViewHelperTagHandlerPopsNodeFromStackForSelfClosingTags() {
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('popNodeFromStack')->will($this->returnValue($this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\NodeInterface')));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('parseArguments', 'initializeViewHelperAndAddItToStack'));
+
                $templateParser->_call('openingViewHelperTagHandler', $mockState, '', '', array(), TRUE);
        }
 
@@ -198,16 +310,21 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function initializeViewHelperAndAddItToStackCreatesRequestedViewHelperAndViewHelperNode() {
                $mockViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper');
                $mockViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array(), array(), '', FALSE);
+
                $mockNodeOnStack = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\NodeInterface');
                $mockNodeOnStack->expects($this->once())->method('addChildNode')->with($mockViewHelperNode);
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
-               $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\CMS\Fluid\ViewHelpers\MyownViewHelper')->will($this->returnValue($mockViewHelper));
+               $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\MyownViewHelper')->will($this->returnValue($mockViewHelper));
                $mockObjectManager->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode')->will($this->returnValue($mockViewHelperNode));
+
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
                $mockState->expects($this->once())->method('pushNodeToStack')->with($mockViewHelperNode);
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('abortIfUnregisteredArgumentsExist', 'abortIfRequiredArgumentsAreMissing', 'rewriteBooleanNodesInArgumentsObjectTree'));
                $templateParser->injectObjectManager($mockObjectManager);
+
                $templateParser->_call('initializeViewHelperAndAddItToStack', $mockState, 'f', 'myown', array('arguments'));
        }
 
@@ -217,19 +334,25 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function initializeViewHelperAndAddItToStackChecksViewHelperArguments() {
                $expectedArguments = array('expectedArguments');
                $argumentsObjectTree = array('arguments');
+
                $mockViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper');
                $mockViewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue($expectedArguments));
                $mockViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array(), array(), '', FALSE);
+
                $mockNodeOnStack = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\NodeInterface');
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
-               $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\CMS\Fluid\ViewHelpers\MyownViewHelper')->will($this->returnValue($mockViewHelper));
+               $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\MyownViewHelper')->will($this->returnValue($mockViewHelper));
                $mockObjectManager->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode')->will($this->returnValue($mockViewHelperNode));
+
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('abortIfUnregisteredArgumentsExist', 'abortIfRequiredArgumentsAreMissing', 'rewriteBooleanNodesInArgumentsObjectTree'));
                $templateParser->injectObjectManager($mockObjectManager);
                $templateParser->expects($this->once())->method('abortIfUnregisteredArgumentsExist')->with($expectedArguments, $argumentsObjectTree);
                $templateParser->expects($this->once())->method('abortIfRequiredArgumentsAreMissing')->with($expectedArguments, $argumentsObjectTree);
+
                $templateParser->_call('initializeViewHelperAndAddItToStack', $mockState, 'f', 'myown', $argumentsObjectTree);
        }
 
@@ -239,16 +362,21 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function initializeViewHelperAndAddItToStackHandlesPostParseFacets() {
                $mockViewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\Fixtures\\PostParseFacetViewHelper', array('prepareArguments'));
                $mockViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array(), array(), '', FALSE);
+
                $mockNodeOnStack = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\NodeInterface');
                $mockNodeOnStack->expects($this->once())->method('addChildNode')->with($mockViewHelperNode);
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
-               $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\CMS\Fluid\ViewHelpers\MyownViewHelper')->will($this->returnValue($mockViewHelper));
+               $mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\MyownViewHelper')->will($this->returnValue($mockViewHelper));
                $mockObjectManager->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode')->will($this->returnValue($mockViewHelperNode));
+
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
                $mockState->expects($this->once())->method('getVariableContainer')->will($this->returnValue($this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TemplateVariableContainer')));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('abortIfUnregisteredArgumentsExist', 'abortIfRequiredArgumentsAreMissing', 'rewriteBooleanNodesInArgumentsObjectTree'));
                $templateParser->injectObjectManager($mockObjectManager);
+
                $templateParser->_call('initializeViewHelperAndAddItToStack', $mockState, 'f', 'myown', array('arguments'));
                $this->assertTrue(\TYPO3\CMS\Fluid\Core\Parser\Fixtures\PostParseFacetViewHelper::$wasCalled, 'PostParse was not called!');
        }
@@ -260,7 +388,9 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function abortIfUnregisteredArgumentsExistThrowsExceptionOnUnregisteredArguments() {
                $expected = array(new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('firstArgument', 'string', '', FALSE));
                $actual = array('firstArgument' => 'foo', 'secondArgument' => 'bar');
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+
                $templateParser->_call('abortIfUnregisteredArgumentsExist', $expected, $actual);
        }
 
@@ -275,8 +405,12 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $actualArguments = array(
                        'name1' => 'bla'
                );
+
                $mockTemplateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+
                $mockTemplateParser->_call('abortIfUnregisteredArgumentsExist', $expectedArguments, $actualArguments);
+               // dummy assertion to avoid "did not perform any assertions" error
+               $this->assertTrue(TRUE);
        }
 
        /**
@@ -288,7 +422,9 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('firstArgument', 'string', '', FALSE),
                        new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('secondArgument', 'string', '', TRUE)
                );
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+
                $templateParser->_call('abortIfRequiredArgumentsAreMissing', $expected, array());
        }
 
@@ -303,8 +439,12 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $actualArguments = array(
                        'name2' => 'bla'
                );
+
                $mockTemplateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+
                $mockTemplateParser->_call('abortIfRequiredArgumentsAreMissing', $expectedArguments, $actualArguments);
+               // dummy assertion to avoid "did not perform any assertions" error
+               $this->assertTrue(TRUE);
        }
 
        /**
@@ -315,7 +455,9 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockNodeOnStack = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\NodeInterface', array(), array(), '', FALSE);
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('popNodeFromStack')->will($this->returnValue($mockNodeOnStack));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+
                $templateParser->_call('closingViewHelperTagHandler', $mockState, 'f', 'method');
        }
 
@@ -327,7 +469,9 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockNodeOnStack = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array(), array(), '', FALSE);
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('popNodeFromStack')->will($this->returnValue($mockNodeOnStack));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
+
                $templateParser->_call('closingViewHelperTagHandler', $mockState, 'f', 'method');
        }
 
@@ -337,11 +481,13 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function objectAccessorHandlerCallsInitializeViewHelperAndAddItToStackIfViewHelperSyntaxIsPresent() {
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->exactly(2))->method('popNodeFromStack')->will($this->returnValue($this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\NodeInterface')));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('recursiveArrayHandler', 'postProcessArgumentsForObjectAccessor', 'initializeViewHelperAndAddItToStack'));
                $templateParser->expects($this->at(0))->method('recursiveArrayHandler')->with('format: "H:i"')->will($this->returnValue(array('format' => 'H:i')));
                $templateParser->expects($this->at(1))->method('postProcessArgumentsForObjectAccessor')->with(array('format' => 'H:i'))->will($this->returnValue(array('processedArguments')));
                $templateParser->expects($this->at(2))->method('initializeViewHelperAndAddItToStack')->with($mockState, 'f', 'format.date', array('processedArguments'));
                $templateParser->expects($this->at(3))->method('initializeViewHelperAndAddItToStack')->with($mockState, 'f', 'base', array());
+
                $templateParser->_call('objectAccessorHandler', $mockState, '', '', 'f:base() f:format.date(format: "H:i")', '');
        }
 
@@ -350,14 +496,18 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function objectAccessorHandlerCreatesObjectAccessorNodeWithExpectedValueAndAddsItToStack() {
                $objectAccessorNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', array(), array(), '', FALSE);
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->once())->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', 'objectAccessorString')->will($this->returnValue($objectAccessorNode));
+
                $mockNodeOnStack = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\AbstractNode', array(), array(), '', FALSE);
                $mockNodeOnStack->expects($this->once())->method('addChildNode')->with($objectAccessorNode);
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
                $templateParser->injectObjectManager($mockObjectManager);
+
                $templateParser->_call('objectAccessorHandler', $mockState, 'objectAccessorString', '', '', '');
        }
 
@@ -368,21 +518,25 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $objectAccessorNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', array(), array(), '', FALSE);
                $objectAccessorNodeInterceptor = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\InterceptorInterface');
                $objectAccessorNodeInterceptor->expects($this->once())->method('process')->with($objectAccessorNode)->will($this->returnArgument(0));
+
                $parserConfiguration = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\Configuration');
                $parserConfiguration->expects($this->once())->method('getInterceptors')->with(\TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OBJECTACCESSOR)->will($this->returnValue(array($objectAccessorNodeInterceptor)));
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->once())->method('get')->will($this->returnValue($objectAccessorNode));
+
                $mockNodeOnStack = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\AbstractNode', array(), array(), '', FALSE);
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
                $templateParser->injectObjectManager($mockObjectManager);
                $templateParser->_set('configuration', $parserConfiguration);
+
                $templateParser->_call('objectAccessorHandler', $mockState, 'objectAccessorString', '', '', '');
        }
 
        /**
-
         */
        public function argumentsStrings() {
                return array(
@@ -395,10 +549,13 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @test
         * @dataProvider argumentsStrings
+        * @param string $argumentsString
+        * @param array $expected
         */
-       public function parseArgumentsWorksAsExpected($argumentsString, $expected) {
+       public function parseArgumentsWorksAsExpected($argumentsString, array $expected) {
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('buildArgumentObjectTree'));
                $templateParser->expects($this->any())->method('buildArgumentObjectTree')->will($this->returnArgument(0));
+
                $this->assertSame($expected, $templateParser->_call('parseArguments', $argumentsString));
        }
 
@@ -408,8 +565,10 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function buildArgumentObjectTreeReturnsTextNodeForSimplyString() {
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->once())->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\TextNode', 'a very plain string')->will($this->returnValue('theTextNode'));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('dummy'));
                $templateParser->injectObjectManager($mockObjectManager);
+
                $this->assertEquals('theTextNode', $templateParser->_call('buildArgumentObjectTree', 'a very plain string'));
        }
 
@@ -419,9 +578,11 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function buildArgumentObjectTreeBuildsObjectTreeForComlexString() {
                $objectTree = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $objectTree->expects($this->once())->method('getRootNode')->will($this->returnValue('theRootNode'));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('splitTemplateAtDynamicTags', 'buildObjectTree'));
                $templateParser->expects($this->at(0))->method('splitTemplateAtDynamicTags')->with('a <very> {complex} string')->will($this->returnValue('split string'));
                $templateParser->expects($this->at(1))->method('buildObjectTree')->with('split string')->will($this->returnValue($objectTree));
+
                $this->assertEquals('theRootNode', $templateParser->_call('buildArgumentObjectTree', 'a <very> {complex} string'));
        }
 
@@ -432,11 +593,13 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->any())->method('get')->will($this->returnArgument(1));
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('objectAccessorHandler', 'arrayHandler', 'textHandler'));
                $templateParser->injectObjectManager($mockObjectManager);
                $templateParser->expects($this->at(0))->method('objectAccessorHandler')->with($mockState, 'someThing.absolutely', '', '', '');
                $templateParser->expects($this->at(1))->method('textHandler')->with($mockState, ' "fishy" is \'going\' ');
                $templateParser->expects($this->at(2))->method('arrayHandler')->with($mockState, 'on: "here"');
+
                $text = '{someThing.absolutely} "fishy" is \'going\' {on: "here"}';
                $templateParser->_call('textAndShorthandSyntaxHandler', $mockState, $text);
        }
@@ -450,22 +613,28 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockNodeOnStack->expects($this->once())->method('addChildNode')->with($arrayNode);
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->once())->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ArrayNode', 'processedArrayText')->will($this->returnValue($arrayNode));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('recursiveArrayHandler'));
                $templateParser->injectObjectManager($mockObjectManager);
                $templateParser->expects($this->once())->method('recursiveArrayHandler')->with('arrayText')->will($this->returnValue('processedArrayText'));
+
                $templateParser->_call('arrayHandler', $mockState, 'arrayText');
        }
 
        /**
-
         */
        public function arrayTexts() {
                return array(
                        array(
                                'key1: "foo", key2: \'bar\', key3: someVar, key4: 123, key5: { key6: "baz" }',
                                array('key1' => 'foo', 'key2' => 'bar', 'key3' => 'someVar', 'key4' => 123.0, 'key5' => array('key6' => 'baz'))
+                       ),
+                       array(
+                               'key1: "\'foo\'", key2: \'\\\'bar\\\'\'',
+                               array('key1' => '\'foo\'', 'key2' => '\'bar\'')
                        )
                );
        }
@@ -477,9 +646,11 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function recursiveArrayHandlerReturnsExpectedArray($arrayText, $expectedArray) {
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->any())->method('get')->will($this->returnArgument(1));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('buildArgumentObjectTree'));
                $templateParser->injectObjectManager($mockObjectManager);
                $templateParser->expects($this->any())->method('buildArgumentObjectTree')->will($this->returnArgument(0));
+
                $this->assertSame($expectedArray, $templateParser->_call('recursiveArrayHandler', $arrayText));
        }
 
@@ -490,17 +661,22 @@ class TemplateParserTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $textNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\TextNode', array(), array(), '', FALSE);
                $textInterceptor = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\InterceptorInterface');
                $textInterceptor->expects($this->once())->method('process')->with($textNode)->will($this->returnArgument(0));
+
                $parserConfiguration = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\Configuration');
                $parserConfiguration->expects($this->once())->method('getInterceptors')->with(\TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_TEXT)->will($this->returnValue(array($textInterceptor)));
+
                $mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $mockObjectManager->expects($this->once())->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\TextNode', 'string')->will($this->returnValue($textNode));
+
                $mockNodeOnStack = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\AbstractNode', array(), array(), '', FALSE);
                $mockNodeOnStack->expects($this->once())->method('addChildNode')->with($textNode);
                $mockState = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsingState');
                $mockState->expects($this->once())->method('getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
+
                $templateParser = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array('splitTemplateAtDynamicTags', 'buildObjectTree'));
                $templateParser->injectObjectManager($mockObjectManager);
                $templateParser->_set('configuration', $parserConfiguration);
+
                $templateParser->_call('textHandler', $mockState, 'string');
        }
 }
index 82e1be8..0be1756 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/../../ViewHelpers/ViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/../../ViewHelpers/ViewHelperBaseTestcase.php');
 
 /**
  * Testcase for Condition ViewHelper
@@ -39,6 +40,7 @@ class AbstractConditionViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
         */
        public function renderThenChildReturnsAllChildrenIfNoThenViewHelperChildExists() {
                $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue('foo'));
+
                $actualResult = $this->viewHelper->_call('renderThenChild');
                $this->assertEquals('foo', $actualResult);
        }
@@ -50,6 +52,7 @@ class AbstractConditionViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockThenViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array('getViewHelperClassName', 'evaluate'), array(), '', FALSE);
                $mockThenViewHelperNode->expects($this->at(0))->method('getViewHelperClassName')->will($this->returnValue('TYPO3\\CMS\\Fluid\\ViewHelpers\\ThenViewHelper'));
                $mockThenViewHelperNode->expects($this->at(1))->method('evaluate')->with($this->renderingContext)->will($this->returnValue('ThenViewHelperResults'));
+
                $this->viewHelper->setChildNodes(array($mockThenViewHelperNode));
                $actualResult = $this->viewHelper->_call('renderThenChild');
                $this->assertEquals('ThenViewHelperResults', $actualResult);
@@ -70,6 +73,7 @@ class AbstractConditionViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockElseViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array('getViewHelperClassName', 'evaluate', 'setRenderingContext'), array(), '', FALSE);
                $mockElseViewHelperNode->expects($this->at(0))->method('getViewHelperClassName')->will($this->returnValue('TYPO3\\CMS\\Fluid\\ViewHelpers\\ElseViewHelper'));
                $mockElseViewHelperNode->expects($this->at(1))->method('evaluate')->with($this->renderingContext)->will($this->returnValue('ElseViewHelperResults'));
+
                $this->viewHelper->setChildNodes(array($mockElseViewHelperNode));
                $actualResult = $this->viewHelper->_call('renderElseChild');
                $this->assertEquals('ElseViewHelperResults', $actualResult);
@@ -82,6 +86,7 @@ class AbstractConditionViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $this->viewHelper->expects($this->atLeastOnce())->method('hasArgument')->with('then')->will($this->returnValue(TRUE));
                $this->arguments['then'] = 'ThenArgument';
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $actualResult = $this->viewHelper->_call('renderThenChild');
                $this->assertEquals('ThenArgument', $actualResult);
        }
@@ -94,6 +99,7 @@ class AbstractConditionViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockElseViewHelperNode->expects($this->any())->method('getViewHelperClassName')->will($this->returnValue('TYPO3\\CMS\\Fluid\\ViewHelpers\\ElseViewHelper'));
                $this->viewHelper->setChildNodes(array($mockElseViewHelperNode));
                $this->viewHelper->expects($this->never())->method('renderChildren')->will($this->returnValue('Child nodes'));
+
                $actualResult = $this->viewHelper->_call('renderThenChild');
                $this->assertEquals('', $actualResult);
        }
@@ -104,10 +110,14 @@ class AbstractConditionViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
        public function thenArgumentHasPriorityOverChildNodesIfConditionIsTrue() {
                $mockThenViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array('getViewHelperClassName', 'evaluate', 'setRenderingContext'), array(), '', FALSE);
                $mockThenViewHelperNode->expects($this->never())->method('evaluate');
+
                $this->viewHelper->setChildNodes(array($mockThenViewHelperNode));
+
                $this->viewHelper->expects($this->atLeastOnce())->method('hasArgument')->with('then')->will($this->returnValue(TRUE));
                $this->arguments['then'] = 'ThenArgument';
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $actualResult = $this->viewHelper->_call('renderThenChild');
                $this->assertEquals('ThenArgument', $actualResult);
        }
@@ -119,6 +129,7 @@ class AbstractConditionViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $this->viewHelper->expects($this->atLeastOnce())->method('hasArgument')->with('else')->will($this->returnValue(TRUE));
                $this->arguments['else'] = 'ElseArgument';
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $actualResult = $this->viewHelper->_call('renderElseChild');
                $this->assertEquals('ElseArgument', $actualResult);
        }
@@ -130,10 +141,13 @@ class AbstractConditionViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockElseViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array('getViewHelperClassName', 'evaluate', 'setRenderingContext'), array(), '', FALSE);
                $mockElseViewHelperNode->expects($this->any())->method('getViewHelperClassName')->will($this->returnValue('TYPO3\\CMS\\Fluid\\ViewHelpers\\ElseViewHelper'));
                $mockElseViewHelperNode->expects($this->never())->method('evaluate');
+
                $this->viewHelper->setChildNodes(array($mockElseViewHelperNode));
+
                $this->viewHelper->expects($this->atLeastOnce())->method('hasArgument')->with('else')->will($this->returnValue(TRUE));
                $this->arguments['else'] = 'ElseArgument';
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $actualResult = $this->viewHelper->_call('renderElseChild');
                $this->assertEquals('ElseArgument', $actualResult);
        }
index 668718a..a8e1442 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for TagBasedViewHelper
  */
@@ -26,6 +27,7 @@ class AbstractTagBasedViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('reset'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('reset');
                $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
                $this->viewHelper->initialize();
        }
 
@@ -36,6 +38,7 @@ class AbstractTagBasedViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                $mockTagBuilder = $this->getMock('TYPO3\\CMS\\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 = array('foo' => 'bar');
                $this->viewHelper->setArguments($arguments);
@@ -49,6 +52,7 @@ class AbstractTagBasedViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                $mockTagBuilder = $this->getMock('TYPO3\\CMS\\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 = array('additionalAttributes' => array('foo' => 'bar'));
                $this->viewHelper->setArguments($arguments);
@@ -69,6 +73,7 @@ class AbstractTagBasedViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                $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 = array(
                        'class' => 'classAttribute',
                        'dir' => 'dirAttribute',
index 8908720..1b0a26e 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,8 +10,9 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/../Fixtures/TestViewHelper.php';
-require_once dirname(__FILE__) . '/../Fixtures/TestViewHelper2.php';
+
+require_once(dirname(__FILE__) . '/../Fixtures/TestViewHelper.php');
+require_once(dirname(__FILE__) . '/../Fixtures/TestViewHelper2.php');
 
 /**
  * Testcase for AbstractViewHelper
@@ -19,17 +20,64 @@ require_once dirname(__FILE__) . '/../Fixtures/TestViewHelper2.php';
 class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
+        */
+       protected $mockReflectionService;
+
+       /**
+        * @var array
+        */
+       protected $fixtureMethodParameters = array(
+               'param1' => array(
+                       'position' => 0,
+                       'optional' => FALSE,
+                       'type' => 'integer',
+                       'defaultValue' => NULL
+               ),
+               'param2' => array(
+                       'position' => 1,
+                       'optional' => FALSE,
+                       'type' => 'array',
+                       'array' => TRUE,
+                       'defaultValue' => NULL
+               ),
+               'param3' => array(
+                       'position' => 2,
+                       'optional' => TRUE,
+                       'type' => 'string',
+                       'array' => FALSE,
+                       'defaultValue' => 'default'
+               ),
+       );
+
+       /**
+        * @var array
+        */
+       protected $fixtureMethodTags = array(
+               'param' => array(
+                       'integer $param1 P1 Stuff',
+                       'array $param2 P2 Stuff',
+                       'string $param3 P3 Stuff'
+               )
+       );
+
+       public function setUp() {
+               $this->mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
+       }
+
+       /**
         * @test
         */
        public function argumentsCanBeRegistered() {
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render'), array(), '', FALSE);
-               $viewHelper->injectReflectionService($mockReflectionService);
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $name = 'This is a name';
                $description = 'Example desc';
                $type = 'string';
                $isRequired = TRUE;
                $expected = new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition($name, $type, $description, $isRequired);
+
                $viewHelper->_call('registerArgument', $name, $type, $description, $isRequired);
                $this->assertEquals(array($name => $expected), $viewHelper->prepareArguments(), 'Argument definitions not returned correctly.');
        }
@@ -40,10 +88,12 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         */
        public function registeringTheSameArgumentNameAgainThrowsException() {
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render'), array(), '', FALSE);
+
                $name = 'shortName';
                $description = 'Example desc';
                $type = 'string';
                $isRequired = TRUE;
+
                $viewHelper->_call('registerArgument', $name, $type, $description, $isRequired);
                $viewHelper->_call('registerArgument', $name, 'integer', $description, $isRequired);
        }
@@ -52,9 +102,9 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         * @test
         */
        public function overrideArgumentOverwritesExistingArgumentDefinition() {
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render'), array(), '', FALSE);
-               $viewHelper->injectReflectionService($mockReflectionService);
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $name = 'argumentName';
                $description = 'argument description';
                $overriddenDescription = 'overwritten argument description';
@@ -62,6 +112,7 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                $overriddenType = 'integer';
                $isRequired = TRUE;
                $expected = new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition($name, $overriddenType, $overriddenDescription, $isRequired);
+
                $viewHelper->_call('registerArgument', $name, $type, $description, $isRequired);
                $viewHelper->_call('overrideArgument', $name, $overriddenType, $overriddenDescription, $isRequired);
                $this->assertEquals($viewHelper->prepareArguments(), array($name => $expected), 'Argument definitions not returned correctly. The original ArgumentDefinition could not be overridden.');
@@ -72,9 +123,9 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         * @expectedException \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
         */
        public function overrideArgumentThrowsExceptionWhenTryingToOverwriteAnNonexistingArgument() {
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render'), array(), '', FALSE);
-               $viewHelper->injectReflectionService($mockReflectionService);
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $viewHelper->_call('overrideArgument', 'argumentName', 'string', 'description', TRUE);
        }
 
@@ -82,10 +133,11 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         * @test
         */
        public function prepareArgumentsCallsInitializeArguments() {
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'initializeArguments'), array(), '', FALSE);
-               $viewHelper->injectReflectionService($mockReflectionService);
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $viewHelper->expects($this->once())->method('initializeArguments');
+
                $viewHelper->prepareArguments();
        }
 
@@ -93,23 +145,27 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         * @test
         */
        public function prepareArgumentsRegistersAnnotationBasedArgumentsWithDescriptionIfDebugModeIsEnabled() {
+
                \TYPO3\CMS\Fluid\Fluid::$debugMode = TRUE;
-               $availableClassNames = array(
-                       array('TYPO3\\CMS\\Fluid\\Tests\\Unit\\Core\\Fixtures\\TestViewHelper')
-               );
+
                $dataCacheMock = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', array(), array(), '', FALSE);
                $dataCacheMock->expects($this->any())->method('has')->will($this->returnValue(TRUE));
                $dataCacheMock->expects($this->any())->method('get')->will($this->returnValue(array()));
-               $reflectionService = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
-               $reflectionService->setDataCache($dataCacheMock);
+
                $viewHelper = new \TYPO3\CMS\Fluid\Tests\Unit\Core\Fixtures\TestViewHelper();
-               $viewHelper->injectReflectionService($reflectionService);
+
+               $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('TYPO3\\CMS\\Fluid\\Tests\\Unit\\Core\\Fixtures\\TestViewHelper', 'render')->will($this->returnValue($this->fixtureMethodParameters));
+               $this->mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with('TYPO3\\CMS\\Fluid\\Tests\\Unit\\Core\\Fixtures\\TestViewHelper', 'render')->will($this->returnValue($this->fixtureMethodTags));
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $expected = array(
-                       'param1' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param1', 'integer', 'P1 Stuff', TRUE, NULL, TRUE),
-                       'param2' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param2', 'array', 'P2 Stuff', TRUE, NULL, TRUE),
-                       'param3' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param3', 'string', 'P3 Stuff', FALSE, 'default', TRUE)
+                       'param1' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param1', 'integer', 'P1 Stuff', TRUE, null, TRUE),
+                       'param2' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param2', 'array', 'P2 Stuff', TRUE, null, TRUE),
+                       'param3' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param3', 'string', 'P3 Stuff', FALSE, 'default', TRUE),
                );
+
                $this->assertEquals($expected, $viewHelper->prepareArguments(), 'Annotation based arguments were not registered.');
+
                \TYPO3\CMS\Fluid\Fluid::$debugMode = FALSE;
        }
 
@@ -117,22 +173,25 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         * @test
         */
        public function prepareArgumentsRegistersAnnotationBasedArgumentsWithoutDescriptionIfDebugModeIsDisabled() {
+
                \TYPO3\CMS\Fluid\Fluid::$debugMode = FALSE;
-               $availableClassNames = array(
-                       array('TYPO3\\CMS\\Fluid\\Tests\\Unit\\Core\\Fixtures\\TestViewHelper2')
-               );
+
                $dataCacheMock = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', array(), array(), '', FALSE);
                $dataCacheMock->expects($this->any())->method('has')->will($this->returnValue(TRUE));
                $dataCacheMock->expects($this->any())->method('get')->will($this->returnValue(array()));
-               $reflectionService = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
-               $reflectionService->setDataCache($dataCacheMock);
+
                $viewHelper = new \TYPO3\CMS\Fluid\Tests\Unit\Core\Fixtures\TestViewHelper2();
-               $viewHelper->injectReflectionService($reflectionService);
+
+               $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('TYPO3\\CMS\\Fluid\\Tests\\Unit\\Core\\Fixtures\\TestViewHelper2', 'render')->will($this->returnValue($this->fixtureMethodParameters));
+               $this->mockReflectionService->expects($this->never())->method('getMethodTagsValues');
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $expected = array(
                        'param1' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param1', 'integer', '', TRUE, NULL, TRUE),
                        'param2' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param2', 'array', '', TRUE, NULL, TRUE),
                        'param3' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('param3', 'string', '', FALSE, 'default', TRUE)
                );
+
                $this->assertEquals($expected, $viewHelper->prepareArguments(), 'Annotation based arguments were not registered.');
        }
 
@@ -140,10 +199,11 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         * @test
         */
        public function validateArgumentsCallsPrepareArguments() {
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'prepareArguments'), array(), '', FALSE);
-               $viewHelper->injectReflectionService($mockReflectionService);
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $viewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue(array()));
+
                $viewHelper->validateArguments();
        }
 
@@ -152,7 +212,8 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         */
        public function validateArgumentsAcceptsAllObjectsImplemtingArrayAccessAsAnArray() {
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'prepareArguments'), array(), '', FALSE);
-               $viewHelper->setArguments(array('test' => new \ArrayObject()));
+
+               $viewHelper->setArguments(array('test' => new \ArrayObject));
                $viewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue(array('test' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('test', 'array', FALSE, 'documentation'))));
                $viewHelper->validateArguments();
        }
@@ -161,13 +222,15 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         * @test
         */
        public function validateArgumentsCallsTheRightValidators() {
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'prepareArguments'), array(), '', FALSE);
-               $viewHelper->injectReflectionService($mockReflectionService);
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $viewHelper->setArguments(array('test' => 'Value of argument'));
+
                $viewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue(array(
                        'test' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('test', 'string', FALSE, 'documentation')
                )));
+
                $viewHelper->validateArguments();
        }
 
@@ -176,13 +239,15 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         * @expectedException \InvalidArgumentException
         */
        public function validateArgumentsCallsTheRightValidatorsAndThrowsExceptionIfValidationIsWrong() {
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'prepareArguments'), array(), '', FALSE);
-               $viewHelper->injectReflectionService($mockReflectionService);
+               $viewHelper->injectReflectionService($this->mockReflectionService);
+
                $viewHelper->setArguments(array('test' => 'test'));
+
                $viewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue(array(
                        'test' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('test', 'stdClass', FALSE, 'documentation')
                )));
+
                $viewHelper->validateArguments();
        }
 
@@ -194,6 +259,7 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                $viewHelper->expects($this->at(0))->method('validateArguments');
                $viewHelper->expects($this->at(1))->method('initialize');
                $viewHelper->expects($this->at(2))->method('callRenderMethod')->will($this->returnValue('Output'));
+
                $expectedOutput = 'Output';
                $actualOutput = $viewHelper->initializeArgumentsAndRender(array('argument1' => 'value1'));
                $this->assertEquals($expectedOutput, $actualOutput);
@@ -206,12 +272,16 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                $templateVariableContainer = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TemplateVariableContainer');
                $viewHelperVariableContainer = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer');
                $controllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
+
                $renderingContext = new \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext();
                $renderingContext->injectTemplateVariableContainer($templateVariableContainer);
                $renderingContext->injectViewHelperVariableContainer($viewHelperVariableContainer);
                $renderingContext->setControllerContext($controllerContext);
+
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'prepareArguments'), array(), '', FALSE);
+
                $viewHelper->setRenderingContext($renderingContext);
+
                $this->assertSame($viewHelper->_get('templateVariableContainer'), $templateVariableContainer);
                $this->assertSame($viewHelper->_get('viewHelperVariableContainer'), $viewHelperVariableContainer);
                $this->assertSame($viewHelper->_get('controllerContext'), $controllerContext);
index 82501fe..3be0c6d 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,8 +10,9 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
- * Testcase for Tx_Fluid_Core_ViewHelper_ArgumentDefinition
+ * Testcase for \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition
  */
 class ArgumentDefinitionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
@@ -25,6 +26,7 @@ class ArgumentDefinitionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                $isRequired = TRUE;
                $isMethodParameter = TRUE;
                $argumentDefinition = new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition($name, $type, $description, $isRequired, NULL, $isMethodParameter);
+
                $this->assertEquals($argumentDefinition->getName(), $name, 'Name could not be retrieved correctly.');
                $this->assertEquals($argumentDefinition->getDescription(), $description, 'Description could not be retrieved correctly.');
                $this->assertEquals($argumentDefinition->getType(), $type, 'Type could not be retrieved correctly');
@@ -33,4 +35,4 @@ class ArgumentDefinitionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
        }
 }
 
-?>
\ No newline at end of file
+?>
index 177b60a..c5c1868 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for TagBuilder
  */
@@ -144,6 +145,25 @@ class TagBuilderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @test
         */
+       public function attributesCanBeAccessed() {
+               $tagBuilder = new \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder('tag');
+               $tagBuilder->addAttribute('attribute1', 'attribute1value');
+               $attributeValue = $tagBuilder->getAttribute('attribute1');
+               $this->assertSame('attribute1value', $attributeValue);
+       }
+
+       /**
+        * @test
+        */
+       public function getAttributeWithMissingAttributeReturnsNull() {
+               $tagBuilder = new \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder('tag');
+               $attributeValue = $tagBuilder->getAttribute('missingattribute');
+               $this->assertNull($attributeValue);
+       }
+
+       /**
+        * @test
+        */
        public function resetResetsTagBuilder() {
                $tagBuilder = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('dummy'));
                $tagBuilder->setTagName('tagName');
@@ -152,6 +172,7 @@ class TagBuilderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $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'));
index 73e19df..6c764b9 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for TemplateVariableContainer
  */
index 2454d8b..ab627d4 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/../Fixtures/TestViewHelper.php';
+
+require_once(dirname(__FILE__) . '/../Fixtures/TestViewHelper.php');
 
 /**
  * Testcase for AbstractViewHelper
@@ -31,10 +32,11 @@ class ViewHelperVariableContainerTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
         */
        public function storedDataCanBeReadOutAgain() {
                $variable = 'Hello world';
-               $this->assertFalse($this->viewHelperVariableContainer->exists('Tx_Fluid_ViewHelpers_TestViewHelper', 'test'));
-               $this->viewHelperVariableContainer->add('Tx_Fluid_ViewHelpers_TestViewHelper', 'test', $variable);
-               $this->assertTrue($this->viewHelperVariableContainer->exists('Tx_Fluid_ViewHelpers_TestViewHelper', 'test'));
-               $this->assertEquals($variable, $this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelpers_TestViewHelper', 'test'));
+               $this->assertFalse($this->viewHelperVariableContainer->exists('TYPO3\\CMS\\Fluid\\ViewHelpers\\TestViewHelper', 'test'));
+               $this->viewHelperVariableContainer->add('TYPO3\\CMS\\Fluid\\ViewHelpers\\TestViewHelper', 'test', $variable);
+               $this->assertTrue($this->viewHelperVariableContainer->exists('TYPO3\\CMS\\Fluid\\ViewHelpers\\TestViewHelper', 'test'));
+
+               $this->assertEquals($variable, $this->viewHelperVariableContainer->get('TYPO3\\CMS\\Fluid\\ViewHelpers\\TestViewHelper', 'test'));
        }
 
        /**
@@ -42,7 +44,7 @@ class ViewHelperVariableContainerTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
         * @expectedException \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
         */
        public function gettingNonNonExistentValueThrowsException() {
-               $this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey');
+               $this->viewHelperVariableContainer->get('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey');
        }
 
        /**
@@ -50,26 +52,26 @@ class ViewHelperVariableContainerTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
         * @expectedException \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
         */
        public function settingKeyWhichIsAlreadyStoredThrowsException() {
-               $this->viewHelperVariableContainer->add('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey', 'value1');
-               $this->viewHelperVariableContainer->add('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey', 'value2');
+               $this->viewHelperVariableContainer->add('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey', 'value1');
+               $this->viewHelperVariableContainer->add('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey', 'value2');
        }
 
        /**
         * @test
         */
        public function addOrUpdateWorks() {
-               $this->viewHelperVariableContainer->add('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey', 'value1');
-               $this->viewHelperVariableContainer->addOrUpdate('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey', 'value2');
-               $this->assertEquals($this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey'), 'value2');
+               $this->viewHelperVariableContainer->add('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey', 'value1');
+               $this->viewHelperVariableContainer->addOrUpdate('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey', 'value2');
+               $this->assertEquals($this->viewHelperVariableContainer->get('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey'), 'value2');
        }
 
        /**
         * @test
         */
        public function aSetValueCanBeRemovedAgain() {
-               $this->viewHelperVariableContainer->add('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey', 'value1');
-               $this->viewHelperVariableContainer->remove('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey');
-               $this->assertFalse($this->viewHelperVariableContainer->exists('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey'));
+               $this->viewHelperVariableContainer->add('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey', 'value1');
+               $this->viewHelperVariableContainer->remove('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey');
+               $this->assertFalse($this->viewHelperVariableContainer->exists('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey'));
        }
 
        /**
@@ -77,7 +79,7 @@ class ViewHelperVariableContainerTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
         * @expectedException \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
         */
        public function removingNonExistentKeyThrowsException() {
-               $this->viewHelperVariableContainer->remove('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey');
+               $this->viewHelperVariableContainer->remove('TYPO3\\CMS\\Fluid\\ViewHelper\\NonExistent', 'nonExistentKey');
        }
 
        /**
index 9f73e3d..ebacfef 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\View;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\View;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Testcase for the TemplateView
  */
@@ -66,7 +67,10 @@ class AbstractTemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
                $this->templateVariableContainer->expects($this->at(1))->method('add')->with('foo', 'FooValue');
                $this->templateVariableContainer->expects($this->at(2))->method('exists')->with('bar')->will($this->returnValue(FALSE));
                $this->templateVariableContainer->expects($this->at(3))->method('add')->with('bar', 'BarValue');
-               $this->view->assign('foo', 'FooValue')->assign('bar', 'BarValue');
+
+               $this->view
+                       ->assign('foo', 'FooValue')
+                       ->assign('bar', 'BarValue');
        }
 
        /**
@@ -78,6 +82,7 @@ class AbstractTemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
                $this->templateVariableContainer->expects($this->at(2))->method('exists')->with('foo')->will($this->returnValue(TRUE));
                $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('foo');
                $this->templateVariableContainer->expects($this->at(4))->method('add')->with('foo', 'FooValueOverridden');
+
                $this->view->assign('foo', 'FooValue');
                $this->view->assign('foo', 'FooValueOverridden');
        }
@@ -92,7 +97,10 @@ class AbstractTemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
                $this->templateVariableContainer->expects($this->at(3))->method('add')->with('bar', 'BarValue');
                $this->templateVariableContainer->expects($this->at(4))->method('exists')->with('baz')->will($this->returnValue(FALSE));
                $this->templateVariableContainer->expects($this->at(5))->method('add')->with('baz', 'BazValue');
-               $this->view->assignMultiple(array('foo' => 'FooValue', 'bar' => 'BarValue'))->assignMultiple(array('baz' => 'BazValue'));
+
+               $this->view
+                       ->assignMultiple(array('foo' => 'FooValue', 'bar' => 'BarValue'))
+                       ->assignMultiple(array('baz' => 'BazValue'));
        }
 
        /**
@@ -106,6 +114,7 @@ class AbstractTemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
                $this->templateVariableContainer->expects($this->at(4))->method('add')->with('foo', 'FooValueOverridden');
                $this->templateVariableContainer->expects($this->at(5))->method('exists')->with('bar')->will($this->returnValue(FALSE));
                $this->templateVariableContainer->expects($this->at(6))->method('add')->with('bar', 'BarValue');
+
                $this->view->assign('foo', 'FooValue');
                $this->view->assignMultiple(array('foo' => 'FooValueOverridden', 'bar' => 'BarValue'));
        }
index 32abd40..0f9fa7d 100644 (file)
@@ -1 +1 @@
-{namespace f=Tx_Fluid_ViewHelpers}<div><f:render section="mySection" /></div>
\ No newline at end of file
+{namespace f=TYPO3\CMS\Fluid\ViewHelpers}<div><f:render section="mySection" /></div>
\ No newline at end of file
index 15bcba6..5fb575f 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\View\Fixtures;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\View\Fixtures;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * [Enter description here]
  */
index eefb0aa..be2f512 100644 (file)
@@ -1,4 +1,4 @@
-{namespace f=Tx_Fluid_ViewHelpers}
+{namespace f=TYPO3\CMS\Fluid\ViewHelpers}
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
index 55e0b1c..48ca978 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\View\Fixtures;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,11 +10,11 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\View\Fixtures;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * [Enter description here]
  */
 class TransparentSyntaxTreeNode extends \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode {
-
        public $variableContainer;
 
        public function evaluate(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext) {
index e8072eb..dd21687 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\View;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,14 +10,14 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\View;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-include_once dirname(__FILE__) . '/Fixtures/TransparentSyntaxTreeNode.php';
-include_once dirname(__FILE__) . '/Fixtures/TemplateViewFixture.php';
+
+include_once(dirname(__FILE__) . '/Fixtures/TransparentSyntaxTreeNode.php');
+include_once(dirname(__FILE__) . '/Fixtures/TemplateViewFixture.php');
+
 /**
  * Testcase for the TemplateView
  */
-@require_once 'vfsStream/vfsStream.php';
-
-// include vfs stream wrapper
+@require_once('vfsStream/vfsStream.php'); // include vfs stream wrapper
 class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
@@ -51,23 +51,28 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function expandGenericPathPatternWorksWithBubblingDisabledAndFormatNotOptional() {
                $mockControllerContext = $this->setupMockControllerContextForPathResolving('MyPackage', NULL, 'My', 'html');
+
                $templateView = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('getTemplateRootPath', 'getPartialRootPath', 'getLayoutRootPath'), array(), '', FALSE);
                $templateView->_set('controllerContext', $mockControllerContext);
                $templateView->expects($this->any())->method('getTemplateRootPath')->will($this->returnValue('Resources/Private/'));
+
                $expected = array('Resources/Private/Templates/My/@action.html');
                $actual = $templateView->_call('expandGenericPathPattern', '@templateRoot/Templates/@subpackage/@controller/@action.@format', FALSE, FALSE);
                $this->assertEquals($expected, $actual);
        }
 
+
        /**
         * @test
         */
        public function expandGenericPathPatternWorksWithSubpackageAndBubblingDisabledAndFormatNotOptional() {
                $mockControllerContext = $this->setupMockControllerContextForPathResolving('MyPackage', 'MySubPackage', 'My', 'html');
+
                $templateView = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('getTemplateRootPath', 'getPartialRootPath', 'getLayoutRootPath'), array(), '', FALSE);
                $templateView->_set('controllerContext', $mockControllerContext);
                $templateView->expects($this->any())->method('getTemplateRootPath')->will($this->returnValue('Resources/Private/'));
                $actual = $templateView->_call('expandGenericPathPattern', '@templateRoot/Templates/@subpackage/@controller/@action.@format', FALSE, FALSE);
+
                $expected = array(
                        'Resources/Private/Templates/MySubPackage/My/@action.html'
                );
@@ -79,10 +84,12 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function expandGenericPathPatternWorksWithSubpackageAndBubblingDisabledAndFormatOptional() {
                $mockControllerContext = $this->setupMockControllerContextForPathResolving('MyPackage', 'MySubPackage', 'My', 'html');
+
                $templateView = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('getTemplateRootPath', 'getPartialRootPath', 'getLayoutRootPath'), array(), '', FALSE);
                $templateView->_set('controllerContext', $mockControllerContext);
                $templateView->expects($this->any())->method('getTemplateRootPath')->will($this->returnValue('Resources/Private/'));
                $actual = $templateView->_call('expandGenericPathPattern', '@templateRoot/Templates/@subpackage/@controller/@action.@format', FALSE, TRUE);
+
                $expected = array(
                        'Resources/Private/Templates/MySubPackage/My/@action.html',
                        'Resources/Private/Templates/MySubPackage/My/@action'
@@ -95,10 +102,12 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function expandGenericPathPatternWorksWithSubpackageAndBubblingEnabledAndFormatOptional() {
                $mockControllerContext = $this->setupMockControllerContextForPathResolving('MyPackage', 'MySubPackage', 'My', 'html');
+
                $templateView = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('getTemplateRootPath', 'getPartialRootPath', 'getLayoutRootPath'), array(), '', FALSE);
                $templateView->_set('controllerContext', $mockControllerContext);
                $templateView->expects($this->any())->method('getTemplateRootPath')->will($this->returnValue('Resources/Private/'));
                $actual = $templateView->_call('expandGenericPathPattern', '@templateRoot/Templates/@subpackage/@controller/@action.@format', TRUE, TRUE);
+
                $expected = array(
                        'Resources/Private/Templates/MySubPackage/My/@action.html',
                        'Resources/Private/Templates/MySubPackage/My/@action',
@@ -115,20 +124,22 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         *
         * @param string $packageKey
         * @param string $subPackageKey
-        * @param string $controllerName
+        * @param string $controllerClassName
         * @param string $format
         * @return \PHPUnit_Framework_MockObject_MockObject
         */
        protected function setupMockControllerContextForPathResolving($packageKey, $subPackageKey, $controllerName, $format) {
-               $controllerObjectName = "TYPO3\\{$packageKey}\\" . ($subPackageKey != $subPackageKey . '\\' ?: '') . 'Controller\\' . $controllerName . 'Controller';
+               $controllerObjectName = "TYPO3\\$packageKey\\" . ($subPackageKey != $subPackageKey . '\\' ? : '') . 'Controller\\' . $controllerName . 'Controller';
                $mockRequest = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
                $mockRequest->expects($this->any())->method('getControllerPackageKey')->will($this->returnValue($packageKey));
                $mockRequest->expects($this->any())->method('getControllerSubPackageKey')->will($this->returnValue($subPackageKey));
                $mockRequest->expects($this->any())->method('getControllerName')->will($this->returnValue($controllerName));
                $mockRequest->expects($this->any())->method('getControllerObjectName')->will($this->returnValue($controllerObjectName));
                $mockRequest->expects($this->any())->method('getFormat')->will($this->returnValue($format));
+
                $mockControllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext', array('getRequest'), array(), '', FALSE);
                $mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($mockRequest));
+
                return $mockControllerContext;
        }
 
@@ -172,10 +183,11 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->markTestSkipped('Needs to be finished');
                \vfsStreamWrapper::register();
                mkdir('vfs://MyTemplates');
-               file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');
+               \file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');
                $mockRootDirectory = \vfsStreamDirectory::create('ExamplePackagePath/Resources/Private/Partials');
                $mockRootDirectory->getChild('Resources/Private/Partials')->addChild('Partials');
                \vfsStreamWrapper::setRoot($mockRootDirectory);
+
                $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array(''), array(), '', FALSE);
        }
 
@@ -185,17 +197,22 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function resolveTemplatePathAndFilenameChecksDifferentPathPatternsAndReturnsTheFirstPathWhichExists() {
                \vfsStreamWrapper::register();
                mkdir('vfs://MyTemplates');
-               file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');
+               \file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');
+
                $paths = array(
                        'vfs://NonExistantDir/UnknowFile.html',
                        'vfs://MyTemplates/@action.html'
                );
+
                $templateView = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('expandGenericPathPattern'), array(), '', FALSE);
                $templateView->expects($this->once())->method('expandGenericPathPattern')->with('@templateRoot/@subpackage/@controller/@action.@format', FALSE, FALSE)->will($this->returnValue($paths));
+
                $templateView->setTemplateRootPath('MyTemplates');
                $templateView->setPartialRootPath('MyPartials');
                $templateView->setLayoutRootPath('MyLayouts');
+
                $this->assertSame('contentsOfMyCoolAction', $templateView->_call('getTemplateSource', 'myCoolAction'));
+
        }
 
        /**
@@ -204,9 +221,11 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function resolveTemplatePathAndFilenameReturnsTheExplicitlyConfiguredTemplatePathAndFilename() {
                \vfsStreamWrapper::register();
                mkdir('vfs://MyTemplates');
-               file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');
+               \file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');
+
                $templateView = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('dummy'), array(), '', FALSE);
                $templateView->_set('templatePathAndFilename', 'vfs://MyTemplates/MyCoolAction.html');
+
                $this->assertSame('contentsOfMyCoolAction', $templateView->_call('getTemplateSource'));
        }
 }
index d296aea..2508485 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/ViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/ViewHelperBaseTestcase.php');
 
 /**
  * Testcase for AliasViewHelper
@@ -22,10 +23,13 @@ class AliasViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
         */
        public function renderAddsSingleValueToTemplateVariableContainerAndRemovesItAfterRendering() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\AliasViewHelper();
+
                $mockViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array('evaluateChildNodes'), array(), '', FALSE);
                $mockViewHelperNode->expects($this->once())->method('evaluateChildNodes')->will($this->returnValue('foo'));
+
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('someAlias', 'someValue');
                $this->templateVariableContainer->expects($this->at(1))->method('remove')->with('someAlias');
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($mockViewHelperNode);
                $viewHelper->render(array('someAlias' => 'someValue'));
@@ -36,12 +40,15 @@ class AliasViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
         */
        public function renderAddsMultipleValuesToTemplateVariableContainerAndRemovesThemAfterRendering() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\AliasViewHelper();
+
                $mockViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array('evaluateChildNodes'), array(), '', FALSE);
                $mockViewHelperNode->expects($this->once())->method('evaluateChildNodes')->will($this->returnValue('foo'));
+
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('someAlias', 'someValue');
                $this->templateVariableContainer->expects($this->at(1))->method('add')->with('someOtherAlias', 'someOtherValue');
                $this->templateVariableContainer->expects($this->at(2))->method('remove')->with('someAlias');
                $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('someOtherAlias');
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($mockViewHelperNode);
                $viewHelper->render(array('someAlias' => 'someValue', 'someOtherAlias' => 'someOtherValue'));
@@ -52,12 +59,16 @@ class AliasViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
         */
        public function renderDoesNotTouchTemplateVariableContainerAndReturnsChildNodesIfMapIsEmpty() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\AliasViewHelper();
+
                $mockViewHelperNode = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', array('evaluateChildNodes'), array(), '', FALSE);
                $mockViewHelperNode->expects($this->once())->method('evaluateChildNodes')->will($this->returnValue('foo'));
+
                $this->templateVariableContainer->expects($this->never())->method('add');
                $this->templateVariableContainer->expects($this->never())->method('remove');
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($mockViewHelperNode);
+
                $this->assertEquals('foo', $viewHelper->render(array()));
        }
 }
index 0f07a95..cbb59dc 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,10 +10,9 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/ViewHelperBaseTestcase.php';
 
+require_once(dirname(__FILE__) . '/ViewHelperBaseTestcase.php');
 /**
-
  */
 class BaseViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase {
 
index 7b37962..765e920 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/ViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/ViewHelperBaseTestcase.php');
 
 /**
  * Testcase for CountViewHelper
index 82c383e..d526dc4 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/ViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/ViewHelperBaseTestcase.php');
 
 /**
  * Testcase for CycleViewHelper
@@ -35,6 +36,7 @@ class CycleViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
        public function renderAddsCurrentValueToTemplateVariableContainerAndRemovesItAfterRendering() {
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('innerVariable', 'bar');
                $this->templateVariableContainer->expects($this->at(1))->method('remove')->with('innerVariable');
+
                $values = array('bar', 'Fluid');
                $this->viewHelper->render($values, 'innerVariable');
        }
@@ -49,6 +51,7 @@ class CycleViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
                $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('innerVariable');
                $this->templateVariableContainer->expects($this->at(4))->method('add')->with('innerVariable', 'bar');
                $this->templateVariableContainer->expects($this->at(5))->method('remove')->with('innerVariable');
+
                $values = array('bar', 'Fluid');
                $this->viewHelper->render($values, 'innerVariable');
                $this->viewHelper->render($values, 'innerVariable');
@@ -65,6 +68,7 @@ class CycleViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
                $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('innerVariable');
                $this->templateVariableContainer->expects($this->at(4))->method('add')->with('innerVariable', 'FLOW3');
                $this->templateVariableContainer->expects($this->at(5))->method('remove')->with('innerVariable');
+
                $values = array('foo' => 'FLOW3', 'bar' => 'Fluid');
                $this->viewHelper->render($values, 'innerVariable');
                $this->viewHelper->render($values, 'innerVariable');
@@ -77,6 +81,7 @@ class CycleViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
         */
        public function renderThrowsExceptionWhenPassingObjectsToValuesThatAreNotTraversable() {
                $object = new \stdClass();
+
                $this->viewHelper->render($object, 'innerVariable');
        }
 
@@ -85,6 +90,7 @@ class CycleViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
         */
        public function renderReturnsChildNodesIfValuesIsNull() {
                $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('Child nodes'));
+
                $this->assertEquals('Child nodes', $this->viewHelper->render(NULL, 'foo'));
        }
 
@@ -94,7 +100,9 @@ class CycleViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
        public function renderReturnsChildNodesIfValuesIsAnEmptyArray() {
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('foo', NULL);
                $this->templateVariableContainer->expects($this->at(1))->method('remove')->with('foo');
+
                $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('Child nodes'));
+
                $this->assertEquals('Child nodes', $this->viewHelper->render(array(), 'foo'));
        }
 
@@ -108,6 +116,7 @@ class CycleViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHe
                $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('innerVariable');
                $this->templateVariableContainer->expects($this->at(4))->method('add')->with('innerVariable', 'value1');
                $this->templateVariableContainer->expects($this->at(5))->method('remove')->with('innerVariable');
+
                $traversableObject = new \ArrayObject(array('key1' => 'value1', 'key2' => 'value2'));
                $this->viewHelper->render($traversableObject, 'innerVariable');
                $this->viewHelper->render($traversableObject, 'innerVariable');
index 15f5af0..cfb1d41 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/ViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/ViewHelperBaseTestcase.php');
 
 /**
  * Testcase for ElseViewHelper
@@ -22,6 +23,7 @@ class ElseViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHel
         */
        public function renderRendersChildren() {
                $viewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\ElseViewHelper', array('renderChildren'));
+
                $viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('foo'));
                $actualResult = $viewHelper->render();
                $this->assertEquals('foo', $actualResult);
index e638435..c0d548d 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,11 +10,11 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
- * [Enter description here]
+ * Constraint syntax tree node fixture
  */
 class ConstraintSyntaxTreeNode extends \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode {
-
        public $callProtocol = array();
 
        public function __construct(\TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer) {
index 9209b9a..b42b30a 100644 (file)
@@ -1 +1 @@
-{namespace f=Tx_Fluid_ViewHelpers}<f:if condition="{condition}">RenderSomething</f:if>
\ No newline at end of file
+{namespace f=TYPO3\CMS\Fluid\ViewHelpers}<f:if condition="{condition}">RenderSomething</f:if>
\ No newline at end of file
index 43cd556..22cecae 100644 (file)
@@ -1,4 +1,4 @@
-{namespace f=Tx_Fluid_ViewHelpers}<f:if condition="{condition}">
+{namespace f=TYPO3\CMS\Fluid\ViewHelpers}<f:if condition="{condition}">
 Do not display
 <f:then>YEP</f:then>
 <f:else>NOPE</f:else>
diff --git a/typo3/sysext/fluid/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php
new file mode 100644 (file)
index 0000000..980876b
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
+
+/*                                                                        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License, either version 3   *
+ *  of the License, or (at your option) any later version.                *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+require_once(dirname(__FILE__) . '/ViewHelperBaseTestcase.php');
+
+/**
+ * Testcase for FlashMessagesViewHelper
+ */
+class FlashMessagesViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase {
+
+       /**
+        * @var \TYPO3\CMS\Fluid\ViewHelpers\FlashMessagesViewHelper
+        */
+       protected $viewHelper;
+
+       /**
+        * @var \TYPO3\CMS\Extbase\Mvc\Controller\FlashMessageContainer
+        */
+       protected $mockFlashMessageContainer;
+
+       /**
+        * @var \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder
+        */
+       protected $mockTagBuilder;
+
+       /**
+        * Sets up this test case
+        *
+        * @return void
+        */
+       public function setUp() {
+               $this->mockFlashMessageContainer = $this->getMock('\TYPO3\\CMS\\Extbase\\Mvc\\Controller\\FlashMessageContainer');
+               $mockControllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
+               $mockControllerContext->expects($this->any())->method('getFlashMessageContainer')->will($this->returnValue($this->mockFlashMessageContainer));
+
+               $this->mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder');
+               $this->viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\FlashMessagesViewHelper', array('dummy'));
+               $this->viewHelper->_set('controllerContext', $mockControllerContext);
+               $this->viewHelper->_set('tag', $this->mockTagBuilder);
+               $this->viewHelper->initialize();
+       }
+
+       /**
+        * @test
+        */
+       public function renderReturnsEmptyStringIfNoFlashMessagesAreInQueue() {
+               $this->assertEmpty($this->viewHelper->render());
+       }
+}
+
+?>
\ No newline at end of file
index 0300ffc..ff3ee4f 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,8 +10,9 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-include_once dirname(__FILE__) . '/Fixtures/ConstraintSyntaxTreeNode.php';
-require_once dirname(__FILE__) . '/ViewHelperBaseTestcase.php';
+
+include_once(dirname(__FILE__) . '/Fixtures/ConstraintSyntaxTreeNode.php');
+require_once(dirname(__FILE__) . '/ViewHelperBaseTestcase.php');
 
 /**
  * Testcase for ForViewHelper
@@ -22,6 +23,7 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
                parent::setUp();
                $this->templateVariableContainer = new \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer(array());
                $this->renderingContext->injectTemplateVariableContainer($this->templateVariableContainer);
+
                $this->arguments['reverse'] = NULL;
                $this->arguments['key'] = '';
                $this->arguments['iteration'] = NULL;
@@ -32,12 +34,15 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function renderExecutesTheLoopCorrectly() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
                $this->arguments['each'] = array(0, 1, 2, 3);
                $this->arguments['as'] = 'innerVariable';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as']);
+
                $expectedCallProtocol = array(
                        array('innerVariable' => 0),
                        array('innerVariable' => 1),
@@ -52,13 +57,17 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function renderPreservesKeys() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $this->arguments['each'] = array('key1' => 'value1', 'key2' => 'value2');
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['key'] = 'someKey';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key']);
+
                $expectedCallProtocol = array(
                        array(
                                'innerVariable' => 'value1',
@@ -77,9 +86,12 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function renderReturnsEmptyStringIfObjectIsNull() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $this->arguments['each'] = NULL;
                $this->arguments['as'] = 'foo';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
+
                $this->assertEquals('', $viewHelper->render($this->arguments['each'], $this->arguments['as']));
        }
 
@@ -88,9 +100,12 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function renderReturnsEmptyStringIfObjectIsEmptyArray() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $this->arguments['each'] = array();
                $this->arguments['as'] = 'foo';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
+
                $this->assertEquals('', $viewHelper->render($this->arguments['each'], $this->arguments['as']));
        }
 
@@ -99,13 +114,17 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function renderIteratesElementsInReverseOrderIfReverseIsTrue() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $this->arguments['each'] = array(0, 1, 2, 3);
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['reverse'] = TRUE;
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key'], $this->arguments['reverse']);
+
                $expectedCallProtocol = array(
                        array('innerVariable' => 3),
                        array('innerVariable' => 2),
@@ -120,14 +139,18 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function renderPreservesKeysIfReverseIsTrue() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $this->arguments['each'] = array('key1' => 'value1', 'key2' => 'value2');
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['key'] = 'someKey';
                $this->arguments['reverse'] = TRUE;
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key'], $this->arguments['reverse']);
+
                $expectedCallProtocol = array(
                        array(
                                'innerVariable' => 'value2',
@@ -146,13 +169,17 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function keyContainsNumericalIndexIfTheGivenArrayDoesNotHaveAKey() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $this->arguments['each'] = array('foo', 'bar', 'baz');
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['key'] = 'someKey';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key']);
+
                $expectedCallProtocol = array(
                        array(
                                'innerVariable' => 'foo',
@@ -175,14 +202,18 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function keyContainsNumericalIndexInAscendingOrderEvenIfReverseIsTrueIfTheGivenArrayDoesNotHaveAKey() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $this->arguments['each'] = array('foo', 'bar', 'baz');
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['key'] = 'someKey';
                $this->arguments['reverse'] = TRUE;
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key'], $this->arguments['reverse']);
+
                $expectedCallProtocol = array(
                        array(
                                'innerVariable' => 'baz',
@@ -207,25 +238,32 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
        public function renderThrowsExceptionWhenPassingObjectsToEachThatAreNotTraversable() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
                $object = new \stdClass();
+
                $this->arguments['each'] = $object;
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['key'] = 'someKey';
                $this->arguments['reverse'] = TRUE;
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key']);
        }
 
+
        /**
         * @test
         */
        public function renderIteratesThroughElementsOfTraversableObjects() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $this->arguments['each'] = new \ArrayObject(array('key1' => 'value1', 'key2' => 'value2'));
                $this->arguments['as'] = 'innerVariable';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as']);
+
                $expectedCallProtocol = array(
                        array('innerVariable' => 'value1'),
                        array('innerVariable' => 'value2')
@@ -238,13 +276,17 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function renderPreservesKeyWhenIteratingThroughElementsOfObjectsThatImplementIteratorInterface() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $this->arguments['each'] = new \ArrayIterator(array('key1' => 'value1', 'key2' => 'value2'));
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['key'] = 'someKey';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key']);
+
                $expectedCallProtocol = array(
                        array(
                                'innerVariable' => 'value1',
@@ -263,20 +305,25 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function keyContainsTheNumericalIndexWhenIteratingThroughElementsOfObjectsOfTyeSplObjectStorage() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $splObjectStorageObject = new \SplObjectStorage();
                $object1 = new \stdClass();
                $splObjectStorageObject->attach($object1);
                $object2 = new \stdClass();
-               $splObjectStorageObject->attach($object2);
+               $splObjectStorageObject->attach($object2, 'foo');
                $object3 = new \stdClass();
-               $splObjectStorageObject->attach($object3);
+               $splObjectStorageObject->attach($object3, 'bar');
+
                $this->arguments['each'] = $splObjectStorageObject;
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['key'] = 'someKey';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key']);
+
                $expectedCallProtocol = array(
                        array(
                                'innerVariable' => $object1,
@@ -299,13 +346,17 @@ class ForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelp
         */
        public function iterationDataIsAddedToTemplateVariableContainerIfIterationArgumentIsSet() {
                $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper();
+
                $viewHelperNode = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\ConstraintSyntaxTreeNode($this->templateVariableContainer);
+
                $this->arguments['each'] = array('foo' => 'bar', 'FLOW3' => 'Fluid', 'TYPO3' => 'rocks');
                $this->arguments['as'] = 'innerVariable';
                $this->arguments['iteration'] = 'iteration';
+
                $this->injectDependenciesIntoViewHelper($viewHelper);
                $viewHelper->setViewHelperNode($viewHelperNode);
                $viewHelper->render($this->arguments['each'], $this->arguments['as'], $this->arguments['key'], $this->arguments['reverse'], $this->arguments['iteration']);
+
                $expectedCallProtocol = array(
                        array(
                                'innerVariable' => 'bar',
index badad1e..5c8e3f7 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the Abstract Form view helper
@@ -50,10 +51,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
        public function getNameBuildsNameFromFieldNamePrefixFormObjectNameAndPropertyIfInObjectAccessorMode() {
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('isObjectAccessorMode'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formViewHelper);
+
                $formViewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelperVariableContainer->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName')->will($this->returnValue('myObjectName'));
                $this->viewHelperVariableContainer->expects($this->at(1))->method('exists')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')->will($this->returnValue(TRUE));
                $this->viewHelperVariableContainer->expects($this->at(2))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')->will($this->returnValue('formPrefix'));
+
                $arguments = array('name' => 'fieldName', 'value' => 'fieldValue', 'property' => 'bla');
                $formViewHelper->_set('arguments', $arguments);
                $expected = 'formPrefix[myObjectName][bla]';
@@ -67,10 +70,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
        public function getNameBuildsNameFromFieldNamePrefixFormObjectNameAndHierarchicalPropertyIfInObjectAccessorMode() {
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('isObjectAccessorMode'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formViewHelper);
+
                $formViewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelperVariableContainer->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName')->will($this->returnValue('myObjectName'));
                $this->viewHelperVariableContainer->expects($this->at(1))->method('exists')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')->will($this->returnValue(TRUE));
                $this->viewHelperVariableContainer->expects($this->at(2))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')->will($this->returnValue('formPrefix'));
+
                $arguments = array('name' => 'fieldName', 'value' => 'fieldValue', 'property' => 'bla.blubb');
                $formViewHelper->_set('arguments', $arguments);
                $expected = 'formPrefix[myObjectName][bla][blubb]';
@@ -84,10 +89,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
        public function getNameBuildsNameFromFieldNamePrefixAndPropertyIfInObjectAccessorModeAndNoFormObjectNameIsSpecified() {
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('isObjectAccessorMode'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formViewHelper);
+
                $formViewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $this->viewHelperVariableContainer->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName')->will($this->returnValue(NULL));
                $this->viewHelperVariableContainer->expects($this->at(1))->method('exists')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')->will($this->returnValue(TRUE));
                $this->viewHelperVariableContainer->expects($this->at(2))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')->will($this->returnValue('formPrefix'));
+
                $arguments = array('name' => 'fieldName', 'value' => 'fieldValue', 'property' => 'bla');
                $formViewHelper->_set('arguments', $arguments);
                $expected = 'formPrefix[bla]';
@@ -101,9 +108,11 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
        public function getNameBuildsNameFromFieldNamePrefixAndFieldNameIfNotInObjectAccessorMode() {
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('isObjectAccessorMode'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formViewHelper);
+
                $formViewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(FALSE));
                $this->viewHelperVariableContainer->expects($this->at(0))->method('exists')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')->will($this->returnValue(TRUE));
                $this->viewHelperVariableContainer->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')->will($this->returnValue('formPrefix'));
+
                $arguments = array('name' => 'fieldName', 'value' => 'fieldValue', 'property' => 'bla');
                $formViewHelper->_set('arguments', $arguments);
                $expected = 'formPrefix[fieldName]';
@@ -117,6 +126,7 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
        public function getValueBuildsValueFromPropertyAndFormObjectIfInObjectAccessorMode() {
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('isObjectAccessorMode', 'addAdditionalIdentityPropertiesIfNeeded'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formViewHelper);
+
                $className = 'test_' . uniqid();
                $mockObject = eval('
                        class ' . $className . ' {
@@ -129,10 +139,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                        }
                        return new ' . $className . ';
                ');
+
                $formViewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
                $formViewHelper->expects($this->once())->method('addAdditionalIdentityPropertiesIfNeeded');
-               $this->viewHelperVariableContainer->expects($this->once())->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObject')->will($this->returnValue($mockObject));
-               $this->viewHelperVariableContainer->expects($this->once())->method('exists')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObject')->will($this->returnValue(TRUE));
+               $this->viewHelperVariableContainer->expects($this->atLeastOnce())->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObject')->will($this->returnValue($mockObject));
+               $this->viewHelperVariableContainer->expects($this->atLeastOnce())->method('exists')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObject')->will($this->returnValue(TRUE));
+
                $arguments = array('name' => NULL, 'value' => NULL, 'property' => 'value.something');
                $formViewHelper->_set('arguments', $arguments);
                $expected = 'MyString';
@@ -147,8 +159,10 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('isObjectAccessorMode'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formViewHelper);
                $formViewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(FALSE));
+
                $mockArguments = array();
                $formViewHelper->_set('arguments', $mockArguments);
+
                $this->assertNull($formViewHelper->_call('getValue'));
        }
 
@@ -159,8 +173,10 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('isObjectAccessorMode'), array(), '', FALSE);
                $formViewHelper->expects($this->any())->method('isObjectAccessorMode')->will($this->returnValue(FALSE));
                $this->injectDependenciesIntoViewHelper($formViewHelper);
+
                $mockArguments = array('value' => 'someValue');
                $formViewHelper->_set('arguments', $mockArguments);
+
                $this->assertEquals('someValue', $formViewHelper->_call('getValue'));
        }
 
@@ -210,9 +226,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
        public function isObjectAccessorModeReturnsTrueIfPropertyIsSetAndFormObjectIsGiven() {
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('dummy'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formViewHelper);
+
                $this->viewHelperVariableContainer->expects($this->once())->method('exists')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName')->will($this->returnValue(TRUE));
+
                $formViewHelper->_set('arguments', array('name' => NULL, 'value' => NULL, 'property' => 'bla'));
                $this->assertTrue($formViewHelper->_call('isObjectAccessorMode'));
+
                $formViewHelper->_set('arguments', array('name' => NULL, 'value' => NULL, 'property' => NULL));
                $this->assertFalse($formViewHelper->_call('isObjectAccessorMode'));
        }
@@ -222,6 +241,7 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
         */
        public function getErrorsForPropertyReturnsErrorsFromRequestIfPropertyIsSet() {
                $this->markTestIncomplete('Sebastian -- TODO after T3BOARD');
+
                $formViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('isObjectAccessorMode'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formViewHelper);
                $formViewHelper->expects($this->once())->method('isObjectAccessorMode')->will($this->returnValue(TRUE));
@@ -229,6 +249,7 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockArguments->expects($this->once())->method('offsetGet')->with('property')->will($this->returnValue('bar'));
                $formViewHelper->_set('arguments', $mockArguments);
                $this->viewHelperVariableContainer->expects($this->any())->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName')->will($this->returnValue('foo'));
+
                $mockArgumentError = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ArgumentError', array(), array('foo'));
                $mockArgumentError->expects($this->once())->method('getPropertyName')->will($this->returnValue('foo'));
                $mockPropertyError = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\PropertyError', array(), array('bar'));
@@ -237,6 +258,7 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockPropertyError->expects($this->once())->method('getErrors')->will($this->returnValue(array($mockError)));
                $mockArgumentError->expects($this->once())->method('getErrors')->will($this->returnValue(array($mockPropertyError)));
                $this->request->expects($this->once())->method('getErrors')->will($this->returnValue(array($mockArgumentError)));
+
                $errors = $formViewHelper->_call('getErrorsForProperty');
                $this->assertEquals(array($mockError), $errors);
        }
@@ -251,10 +273,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockArguments = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\Arguments', array(), array(), '', FALSE);
                $mockArguments->expects($this->once())->method('hasArgument')->with('property')->will($this->returnValue(FALSE));
                $formViewHelper->_set('arguments', $mockArguments);
+
                $errors = $formViewHelper->_call('getErrorsForProperty');
                $this->assertEquals(array(), $errors);
        }
 
+
        /**
         * @test
         */
@@ -265,7 +289,9 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockArguments = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\Arguments', array(), array(), '', FALSE);
                $mockArguments->expects($this->once())->method('hasArgument')->with('class')->will($this->returnValue(FALSE));
                $formViewHelper->_set('arguments', $mockArguments);
+
                $this->tagBuilder->expects($this->never())->method('addAttribute');
+
                $formViewHelper->_call('setErrorClassAttribute');
        }
 
@@ -280,9 +306,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockArguments->expects($this->at(0))->method('hasArgument')->with('class')->will($this->returnValue(FALSE));
                $mockArguments->expects($this->at(1))->method('hasArgument')->with('errorClass')->will($this->returnValue(FALSE));
                $formViewHelper->_set('arguments', $mockArguments);
+
                $mockError = $this->getMock('TYPO3\\CMS\\Extbase\\Error\\Error', array(), array(), '', FALSE);
                $formViewHelper->expects($this->once())->method('getErrorsForProperty')->will($this->returnValue(array($mockError)));
+
                $this->tagBuilder->expects($this->once())->method('addAttribute')->with('class', 'error');
+
                $formViewHelper->_call('setErrorClassAttribute');
        }
 
@@ -298,9 +327,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockArguments->expects($this->at(1))->method('offsetGet')->with('class')->will($this->returnValue('default classes'));
                $mockArguments->expects($this->at(2))->method('hasArgument')->with('errorClass')->will($this->returnValue(FALSE));
                $formViewHelper->_set('arguments', $mockArguments);
+
                $mockError = $this->getMock('TYPO3\\CMS\\Extbase\\Error\\Error', array(), array(), '', FALSE);
                $formViewHelper->expects($this->once())->method('getErrorsForProperty')->will($this->returnValue(array($mockError)));
+
                $this->tagBuilder->expects($this->once())->method('addAttribute')->with('class', 'default classes error');
+
                $formViewHelper->_call('setErrorClassAttribute');
        }
 
@@ -316,9 +348,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockArguments->expects($this->at(1))->method('hasArgument')->with('errorClass')->will($this->returnValue(TRUE));
                $mockArguments->expects($this->at(2))->method('offsetGet')->with('errorClass')->will($this->returnValue('custom-error-class'));
                $formViewHelper->_set('arguments', $mockArguments);
+
                $mockError = $this->getMock('TYPO3\\CMS\\Extbase\\Error\\Error', array(), array(), '', FALSE);
                $formViewHelper->expects($this->once())->method('getErrorsForProperty')->will($this->returnValue(array($mockError)));
+
                $this->tagBuilder->expects($this->once())->method('addAttribute')->with('class', 'custom-error-class');
+
                $formViewHelper->_call('setErrorClassAttribute');
        }
 
@@ -335,9 +370,12 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $mockArguments->expects($this->at(2))->method('hasArgument')->with('errorClass')->will($this->returnValue(TRUE));
                $mockArguments->expects($this->at(3))->method('offsetGet')->with('errorClass')->will($this->returnValue('custom-error-class'));
                $formViewHelper->_set('arguments', $mockArguments);
+
                $mockError = $this->getMock('TYPO3\\CMS\\Extbase\\Error\\Error', array(), array(), '', FALSE);
                $formViewHelper->expects($this->once())->method('getErrorsForProperty')->will($this->returnValue(array($mockError)));
+
                $this->tagBuilder->expects($this->once())->method('addAttribute')->with('class', 'default classes custom-error-class');
+
                $formViewHelper->_call('setErrorClassAttribute');
        }
 
@@ -372,13 +410,16 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $property = 'value.something';
                $objectName = 'myObject';
                $expectedProperty = 'myObject[value]';
+
                $formFieldViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('renderHiddenIdentityField'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formFieldViewHelper);
                $arguments = array('property' => $property);
                $formFieldViewHelper->_set('arguments', $arguments);
                $this->viewHelperVariableContainer->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObject')->will($this->returnValue($mockFormObject));
                $this->viewHelperVariableContainer->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName')->will($this->returnValue($objectName));
+
                $formFieldViewHelper->expects($this->once())->method('renderHiddenIdentityField')->with($mockFormObject, $expectedProperty);
+
                $formFieldViewHelper->_call('addAdditionalIdentityPropertiesIfNeeded');
        }
 
@@ -402,14 +443,17 @@ class AbstractFormFieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHe
                $objectName = 'myObject';
                $expectedProperty1 = 'myObject[value]';
                $expectedProperty2 = 'myObject[value][value]';
+
                $formFieldViewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\AbstractFormFieldViewHelper', array('renderHiddenIdentityField'), array(), '', FALSE);
                $this->injectDependenciesIntoViewHelper($formFieldViewHelper);
                $arguments = array('property' => $property);
                $formFieldViewHelper->_set('arguments', $arguments);
                $this->viewHelperVariableContainer->expects($this->at(0))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObject')->will($this->returnValue($mockFormObject));
                $this->viewHelperVariableContainer->expects($this->at(1))->method('get')->with('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName')->will($this->returnValue($objectName));
+
                $formFieldViewHelper->expects($this->at(0))->method('renderHiddenIdentityField')->with($mockFormObject, $expectedProperty1);
                $formFieldViewHelper->expects($this->at(1))->method('renderHiddenIdentityField')->with($mockFormObject, $expectedProperty2);
+
                $formFieldViewHelper->_call('addAdditionalIdentityPropertiesIfNeeded');
        }
 
index 7212361..6d952e6 100644 (file)
@@ -32,9 +32,10 @@ class AbstractFormViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers
         */
        public function renderHiddenIdentityFieldReturnsAHiddenInputFieldContainingTheObjectsUID() {
                $className = 'Object' . uniqid();
-               eval('class ' . $className . ' extends TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {
+               $fullClassName = '\\TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\' . $className;
+               eval('namespace TYPO3\\CMS\\Fluid\\ViewHelpers\\Form; class ' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {
                }');
-               $object = $this->getAccessibleMock($className, array('dummy'));
+               $object = $this->getAccessibleMock($fullClassName, array('dummy'));
                $object->_set('uid', 123);
                $expectedResult = chr(10) . '<input type="hidden" name="prefix[theName][__identity]" value="123" />' . chr(10);
                $viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', array('prefixFieldName', 'registerFieldNameForFormTokenGeneration'), array(), '', FALSE);
diff --git a/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/ButtonViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/ButtonViewHelperTest.php
new file mode 100644 (file)
index 0000000..428ba5b
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
+
+/*                                                                        *
+ * This script belongs to the FLOW3 package "TYPO3.Fluid".                *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License, either version 3   *
+ *  of the License, or (at your option) any later version.                *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
+
+/**
+ * Test for the "Button" Form view helper
+ */
+class ButtonViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\FormFieldViewHelperBaseTestcase {
+
+       /**
+        * @var \TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper
+        */
+       protected $viewHelper;
+
+       public function setUp() {
+               parent::setUp();
+               $this->viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\ButtonViewHelper', array('renderChildren'));
+               $this->arguments['name'] = '';
+               $this->injectDependenciesIntoViewHelper($this->viewHelper);
+               $this->viewHelper->initializeArguments();
+       }
+
+       /**
+        * @test
+        */
+       public function renderCorrectlySetsTagNameAndDefaultAttributes() {
+               $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('setTagName', 'addAttribute', 'setContent'));
+               $mockTagBuilder->expects($this->once())->method('setTagName')->with('button');
+               $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('type', 'submit');
+               $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', '');
+               $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', '');
+               $mockTagBuilder->expects($this->at(4))->method('setContent')->with('Button Content');
+
+               $this->viewHelper->expects($this->atLeastOnce())->method('renderChildren')->will($this->returnValue('Button Content'));
+
+               $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
+               $this->viewHelper->initialize();
+               $this->viewHelper->render();
+       }
+}
+
+?>
\ No newline at end of file
index f1d78aa..3f392e0 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the "Checkbox" Form view helper
@@ -40,9 +41,11 @@ class CheckboxViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo');
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
+
                $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->initialize();
                $this->viewHelper->render();
        }
@@ -56,9 +59,11 @@ class CheckboxViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
                $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('checked', 'checked');
+
                $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->initialize();
                $this->viewHelper->render(TRUE);
        }
@@ -66,16 +71,18 @@ class CheckboxViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
        /**
         * @test
         */
-       public function renderIgnoresBoundPropertyIfCheckedIsSet() {
+       public function renderIgnoresValueOfBoundPropertyIfCheckedIsSet() {
                $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('setTagName', 'addAttribute'));
                $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('type', 'checkbox');
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
+
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $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->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->initialize();
                $this->viewHelper->render(TRUE);
                $this->viewHelper->render(FALSE);
@@ -90,11 +97,13 @@ class CheckboxViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
                $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('checked', 'checked');
+
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $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->initialize();
                $this->viewHelper->render();
        }
@@ -108,11 +117,13 @@ class CheckboxViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo[]');
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('foo[]');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
+
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $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->initialize();
                $this->viewHelper->render();
        }
@@ -126,11 +137,13 @@ class CheckboxViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo[]');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
                $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('checked', 'checked');
+
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $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->initialize();
                $this->viewHelper->render();
        }
index 18ca3f5..78d3f89 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * [Enter description here]
  */
index 65a37ce..21572cd 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,10 +10,11 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 /**
  * Example domain class which can be used to test different view helpers, e.g. the "select" view helper.
  */
-class Fixture_UserDomainClass {
+class UserDomainClass {
 
        protected $id;
 
index b15c7be..7e6037a 100644 (file)
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the "Hidden" Form view helper
@@ -39,9 +40,11 @@ class HiddenViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo');
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
+
                $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->initialize();
                $this->viewHelper->render();
        }
index 1b94fd2..febe474 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,12 +10,13 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php';
-require_once dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php';
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php');
+require_once(dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php');
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
- * Test for the "Textbox" Form view helper
+ * Test for the "Password" Form view helper
  */
 class PasswordViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\FormFieldViewHelperBaseTestcase {
 
@@ -39,6 +40,7 @@ class PasswordViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('setTagName'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('input');
                $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
@@ -54,11 +56,13 @@ class PasswordViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('value', 'Current value');
                $mockTagBuilder->expects($this->once())->method('render');
                $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
                $arguments = array(
                        'name' => 'NameOfTextbox',
                        'value' => 'Current value'
                );
                $this->viewHelper->setArguments($arguments);
+
                $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
                $this->viewHelper->initialize();
                $this->viewHelper->render();
index aeff1ad..0261009 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the "Radio" Form view helper
@@ -39,9 +40,11 @@ class RadioViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\F
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo');
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
+
                $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->initialize();
                $this->viewHelper->render();
        }
@@ -56,9 +59,11 @@ class RadioViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\F
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
                $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('checked', 'checked');
+
                $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->initialize();
                $this->viewHelper->render(TRUE);
        }
@@ -71,11 +76,13 @@ class RadioViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\F
                $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('type', 'radio');
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
+
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $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->initialize();
                $this->viewHelper->render(TRUE);
                $this->viewHelper->render(FALSE);
@@ -91,11 +98,13 @@ class RadioViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\F
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
                $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('checked', 'checked');
+
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $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->initialize();
                $this->viewHelper->render();
        }
@@ -109,11 +118,13 @@ class RadioViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\F
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo');
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
+
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $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->initialize();
                $this->viewHelper->render();
        }
@@ -128,11 +139,13 @@ class RadioViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\F
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('foo');
                $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 'bar');
                $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('checked', 'checked');
+
                $this->viewHelper->expects($this->any())->method('getName')->will($this->returnValue('foo'));
                $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->initialize();
                $this->viewHelper->render();
        }
index 76d0eb6..3022be4 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,9 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php';
-require_once dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php';
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php');
+require_once(dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php');
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the "Select" Form view helper
@@ -54,8 +55,10 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         */
        public function selectCorrectlySetsTagName() {
                $this->tagBuilder->expects($this->once())->method('setTagName')->with('select');
+
                $this->arguments['options'] = array();
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
@@ -68,12 +71,14 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="value1">label1</option>' . chr(10) . '<option value="value2" selected="selected">label2</option>' . chr(10));
                $this->tagBuilder->expects($this->once())->method('render');
+
                $this->arguments['options'] = array(
                        'value1' => 'label1',
                        'value2' => 'label2'
                );
                $this->arguments['value'] = 'value2';
                $this->arguments['name'] = 'myName';
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -87,10 +92,12 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value=""></option>' . chr(10));
                $this->tagBuilder->expects($this->once())->method('render');
+
                $this->arguments['options'] = array();
                $this->arguments['value'] = 'value2';
                $this->arguments['name'] = 'myName';
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
@@ -103,14 +110,18 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $this->tagBuilder->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));
                $this->tagBuilder->expects($this->once())->method('render');
+
                $this->arguments['options'] = array(
                        'value3' => 'label3',
                        'value1' => 'label1',
                        'value2' => 'label2'
                );
+
                $this->arguments['value'] = 'value2';
                $this->arguments['name'] = 'myName';
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
@@ -123,14 +134,17 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
                $this->tagBuilder->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));
                $this->tagBuilder->expects($this->once())->method('render');
+
                $this->arguments['options'] = array(
                        'value3' => 'label3',
                        'value1' => 'label1',
                        'value2' => 'label2'
                );
+
                $this->arguments['value'] = 'value2';
                $this->arguments['name'] = 'myName';
                $this->arguments['sortByOptionLabel'] = TRUE;
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -175,15 +189,19 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         */
        public function multipleSelectCreatesExpectedOptions() {
                $this->tagBuilder = new \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder();
+
                $this->arguments['options'] = array(
                        'value1' => 'label1',
                        'value2' => 'label2',
                        'value3' => 'label3'
                );
+
                $this->arguments['value'] = array('value3', 'value1');
                $this->arguments['name'] = 'myName';
                $this->arguments['multiple'] = 'multiple';
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->initializeArguments();
                $this->viewHelper->initialize();
                $result = $this->viewHelper->render();
@@ -204,9 +222,9 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->tagBuilder->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));
                $this->tagBuilder->expects($this->once())->method('render');
 
-               $user_is = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(1, 'Ingmar', 'Schlecht');
-               $user_sk = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(2, 'Sebastian', 'Kurfuerst');
-               $user_rl = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(3, 'Robert', 'Lemke');
+               $user_is = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(1, 'Ingmar', 'Schlecht');
+               $user_sk = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(2, 'Sebastian', 'Kurfuerst');
+               $user_rl = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(3, 'Robert', 'Lemke');
 
                $this->arguments['options'] = array(
                        $user_is,
@@ -230,9 +248,10 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
        public function multipleSelectOnDomainObjectsCreatesExpectedOptions() {
                $this->tagBuilder = new \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder();
                $this->viewHelper->expects($this->exactly(3))->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
-               $user_is = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(1, 'Ingmar', 'Schlecht');
-               $user_sk = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(2, 'Sebastian', 'Kurfuerst');
-               $user_rl = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(3, 'Robert', 'Lemke');
+
+               $user_is = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(1, 'Ingmar', 'Schlecht');
+               $user_sk = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(2, 'Sebastian', 'Kurfuerst');
+               $user_rl = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(3, 'Robert', 'Lemke');
                $this->arguments['options'] = array(
                        $user_is,
                        $user_sk,
@@ -243,40 +262,57 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->arguments['optionLabelField'] = 'lastName';
                $this->arguments['name'] = 'myName';
                $this->arguments['multiple'] = 'multiple';
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->initializeArguments();
                $this->viewHelper->initialize();
                $actual = $this->viewHelper->render();
-               $expected = '<input type="hidden" name="myName" value="" /><select multiple="multiple" name="myName[]"><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) . '</select>';
+               $expected = '<input type="hidden" name="myName" value="" /><select multiple="multiple" name="myName[]"><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) .
+                       '</select>';
+
                $this->assertSame($expected, $actual);
        }
 
        /**
         * @test
-        * @author Johannes K√ľnsebeck <jk@hdnet.de>
         */
        public function multipleSelectOnDomainObjectsCreatesExpectedOptionsWithoutOptionValueField() {
                /** @var $mockPersistenceManager \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface */
                $mockPersistenceManager = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface');
-               $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnCallback(function ($object) {
-                       return $object->getId();
-               }));
+               $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnCallback(
+                       function ($object) {
+                               return $object->getId();
+                       }
+               ));
                $this->viewHelper->injectPersistenceManager($mockPersistenceManager);
+
                $this->tagBuilder = new \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder();
                $this->viewHelper->expects($this->exactly(3))->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
-               $user_is = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(1, 'Ingmar', 'Schlecht');
-               $user_sk = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(2, 'Sebastian', 'Kurfuerst');
-               $user_rl = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(3, 'Robert', 'Lemke');
-               $this->arguments['options'] = array($user_is, $user_sk, $user_rl);
+
+               $user_is = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(1, 'Ingmar', 'Schlecht');
+               $user_sk = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(2, 'Sebastian', 'Kurfuerst');
+               $user_rl = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(3, 'Robert', 'Lemke');
+
+               $this->arguments['options'] = array($user_is,$user_sk,$user_rl);
                $this->arguments['value'] = array($user_rl, $user_is);
                $this->arguments['optionLabelField'] = 'lastName';
                $this->arguments['name'] = 'myName';
                $this->arguments['multiple'] = 'multiple';
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->initializeArguments();
                $this->viewHelper->initialize();
                $actual = $this->viewHelper->render();
-               $expected = '<input type="hidden" name="myName" value="" />' . '<select multiple="multiple" name="myName[]">' . '<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) . '</select>';
+               $expected = '<input type="hidden" name="myName" value="" />' .
+                       '<select multiple="multiple" name="myName[]">' .
+                       '<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) .
+                       '</select>';
                $this->assertSame($expected, $actual);
        }
 
@@ -285,20 +321,19 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         */
        public function selectWithoutFurtherConfigurationOnDomainObjectsUsesUuidForValueAndLabel() {
                $mockPersistenceManager = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface');
-               $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue('fakeUUID'));
+               $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue('fakeUID'));
                $this->viewHelper->injectPersistenceManager($mockPersistenceManager);
 
                $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
                $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
-               $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="fakeUUID">fakeUUID</option>' . chr(10));
+               $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="fakeUID">fakeUID</option>' . chr(10));
                $this->tagBuilder->expects($this->once())->method('render');
 
-               $user = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(1, 'Ingmar', 'Schlecht');
+               $user = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(1, 'Ingmar', 'Schlecht');
 
                $this->arguments['options'] = array(
                        $user
                );
-
                $this->arguments['name'] = 'myName';
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
 
@@ -319,7 +354,7 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="fakeUID">toStringResult</option>' . chr(10));
                $this->tagBuilder->expects($this->once())->method('render');
 
-               $user = $this->getMock('TYPO3\\CMS\\Fluid\\Tests\\Unit\\ViewHelpers\\Form\\Fixtures\\Fixture_UserDomainClass', array('__toString'), array(1, 'Ingmar', 'Schlecht'));
+               $user = $this->getMock('TYPO3\\CMS\\Fluid\\Tests\\Unit\\ViewHelpers\\Form\\Fixtures\\UserDomainClass', array('__toString'), array(1, 'Ingmar', 'Schlecht'));
                $user->expects($this->atLeastOnce())->method('__toString')->will($this->returnValue('toStringResult'));
 
                $this->arguments['options'] = array(
@@ -341,7 +376,7 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue(NULL));
                $this->viewHelper->injectPersistenceManager($mockPersistenceManager);
 
-               $user = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\Fixture_UserDomainClass(1, 'Ingmar', 'Schlecht');
+               $user = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(1, 'Ingmar', 'Schlecht');
 
                $this->arguments['options'] = array(
                        $user
@@ -358,7 +393,9 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         */
        public function renderCallsSetErrorClassAttribute() {
                $this->arguments['options'] = array();
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->expects($this->once())->method('setErrorClassAttribute');
                $this->viewHelper->render();
        }
@@ -368,6 +405,7 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         */
        public function allOptionsAreSelectedIfSelectAllIsTrue() {
                $this->tagBuilder->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->arguments['options'] = array(
                        'value1' => 'label1',
                        'value2' => 'label2',
@@ -376,7 +414,9 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->arguments['name'] = 'myName';
                $this->arguments['multiple'] = 'multiple';
                $this->arguments['selectAllByDefault'] = TRUE;
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
@@ -386,6 +426,7 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         */
        public function selectAllHasNoEffectIfValueIsSet() {
                $this->tagBuilder->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->arguments['options'] = array(
                        'value1' => 'label1',
                        'value2' => 'label2',
@@ -395,7 +436,9 @@ class SelectViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $this->arguments['name'] = 'myName';
                $this->arguments['multiple'] = 'multiple';
                $this->arguments['selectAllByDefault'] = TRUE;
+
                $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
index 4ed82f8..e0c4473 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the "Submit" Form view helper
@@ -18,7 +19,7 @@ require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
 class SubmitViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\FormFieldViewHelperBaseTestcase {
 
        /**
-        * @var Tx_Fluid_ViewHelpers_Form_ubmitViewHelper
+        * @var \TYPO3\CMS\Fluid\ViewHelpers\Form\ubmitViewHelper
         */
        protected $viewHelper;
 
@@ -37,7 +38,9 @@ class SubmitViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
                $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('setTagName', 'addAttribute'));
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('input');
                $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('type', 'submit');
+
                $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
index 251e5f5..c658dfc 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,9 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php';
-require_once dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php';
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php');
+require_once(dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php');
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the "Textarea" Form view helper
@@ -39,6 +40,7 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('setTagName'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('textarea');
                $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
@@ -53,11 +55,13 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $mockTagBuilder->expects($this->once())->method('setContent')->with('Current value');
                $mockTagBuilder->expects($this->once())->method('render');
                $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
                $arguments = array(
                        'name' => 'NameOfTextarea',
                        'value' => 'Current value'
                );
                $this->viewHelper->setArguments($arguments);
+
                $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
                $this->viewHelper->initialize();
                $this->viewHelper->render();
@@ -81,11 +85,13 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
                $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);
+
                $arguments = array(
                        'name' => 'NameOfTextarea',
                        'value' => 'some <tag> & "quotes"'
                );
                $this->viewHelper->setArguments($arguments);
+
                $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
                $this->viewHelper->initialize();
                $this->viewHelper->render();
index ea4a466..cd74c5e 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,9 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php';
-require_once dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php';
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php');
+require_once(dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php');
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the "Textfield" Form view helper
@@ -39,6 +40,7 @@ class TextfieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fo
                $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('setTagName'), array(), '', FALSE);
                $mockTagBuilder->expects($this->once())->method('setTagName')->with('input');
                $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
@@ -54,11 +56,13 @@ class TextfieldViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fo
                $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('value', 'Current value');
                $mockTagBuilder->expects($this->once())->method('render');
                $this->viewHelper->injectTagBuilder($mockTagBuilder);
+
                $arguments = array(
                        'name' => 'NameOfTextfield',
                        'value' => 'Current value'
                );
                $this->viewHelper->setArguments($arguments);
+
                $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
                $this->viewHelper->initialize();
                $this->viewHelper->render();
index ea112b3..3d496bb 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,9 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php';
-require_once dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php';
-require_once dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/Fixtures/EmptySyntaxTreeNode.php');
+require_once(dirname(__FILE__) . '/Fixtures/Fixture_UserDomainClass.php');
+require_once(dirname(__FILE__) . '/FormFieldViewHelperBaseTestcase.php');
 
 /**
  * Test for the "Upload" Form view helper
@@ -37,6 +38,7 @@ class UploadViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         */
        public function renderCorrectlySetsTagName() {
                $this->tagBuilder->expects($this->once())->method('setTagName')->with('input');
+
                $this->viewHelper->initialize();
                $this->viewHelper->render();
        }
index fa44145..8140db5 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 class CurrencyViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index 7f29c33..e3300a7 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
 class DateViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index 70789e8..97a7123 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlentitiesDecodeViewHelper
+ */
 class HtmlentitiesDecodeViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index 46f8f88..2c03178 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlentitiesViewHelper
+ */
 class HtmlentitiesViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index b5f5fcb..59229f7 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlspecialcharsViewHelper
+ */
 class HtmlspecialcharsViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index aec8c16..5f5baa3 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\Nl2brViewHelper
+ */
 class Nl2brViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index 06db5f5..d664695 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\NumberViewHelper
+ */
 class NumberViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index 19aa2d4..c43fa92 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\PaddingViewHelper
+ */
 class PaddingViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index 223051d..83aee82 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for TYPO3\CMS\Fluid\ViewHelpers\Format\PrintfViewHelper
+ */
 class PrintfViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index 218ab1e..b12c1b7 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\RawViewHelper
+ */
 class RawViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index d8de0db..09e850b 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\StripTagsViewHelper
+ */
 class StripTagsViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
@@ -51,7 +55,7 @@ class StripTagsViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
         *
         * @return array
         */
-       public function testStrings() {
+       public function stringsTestDataProvider() {
                return array(
                        array('This is a sample text without special characters.', 'This is a sample text without special characters.'),
                        array('This is a sample text <b>with <i>some</i> tags</b>.', 'This is a sample text with some tags.'),
@@ -61,7 +65,7 @@ class StripTagsViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
 
        /**
         * @test
-        * @dataProvider testStrings
+        * @dataProvider stringsTestDataProvider
         */
        public function renderCorrectlyConvertsIntoPlaintext($source, $expectedResult) {
                $actualResult = $this->viewHelper->render($source);
index e9fff28..ba95df6 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU General Public License, either version 3 of the   *
@@ -10,6 +10,10 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+
+/**
+ * Test for \TYPO3\CMS\Fluid\ViewHelpers\Format\UrlencodeViewHelper
+ */
 class UrlencodeViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
index d7c0f76..a200485 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7 +10,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
-require_once dirname(__FILE__) . '/ViewHelperBaseTestcase.php';
+
+require_once(dirname(__FILE__) . '/ViewHelperBaseTestcase.php');
 
 /**
  * Testcase for GroupedForViewHelper.
@@ -49,6 +50,7 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
         */
        public function renderThrowsExceptionWhenPassingObjectsToEachThatAreNotTraversable() {
                $object = new \stdClass();
+
                $this->viewHelper->render($object, 'innerVariable', 'someKey');
        }
 
@@ -61,7 +63,9 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $office = array('name' => 'Microsoft Office', 'license' => 'commercial');
                $drupal = array('name' => 'Drupal', 'license' => 'GPL');
                $wordpress = array('name' => 'Wordpress', 'license' => 'GPL');
+
                $products = array('photoshop' => $photoshop, 'typo3' => $typo3, 'office' => $office, 'drupal' => $drupal, 'wordpress' => $wordpress);
+
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('myGroupKey', 'commercial');
                $this->templateVariableContainer->expects($this->at(1))->method('add')->with('products', array('photoshop' => $photoshop, 'office' => $office));
                $this->templateVariableContainer->expects($this->at(2))->method('remove')->with('myGroupKey');
@@ -70,6 +74,7 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $this->templateVariableContainer->expects($this->at(5))->method('add')->with('products', array('typo3' => $typo3, 'drupal' => $drupal, 'wordpress' => $wordpress));
                $this->templateVariableContainer->expects($this->at(6))->method('remove')->with('myGroupKey');
                $this->templateVariableContainer->expects($this->at(7))->method('remove')->with('products');
+
                $this->viewHelper->render($products, 'products', 'license', 'myGroupKey');
        }
 
@@ -82,7 +87,9 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $office = new \ArrayObject(array('name' => 'Microsoft Office', 'license' => 'commercial'));
                $drupal = new \ArrayObject(array('name' => 'Drupal', 'license' => 'GPL'));
                $wordpress = new \ArrayObject(array('name' => 'Wordpress', 'license' => 'GPL'));
+
                $products = new \ArrayObject(array('photoshop' => $photoshop, 'typo3' => $typo3, 'office' => $office, 'drupal' => $drupal, 'wordpress' => $wordpress));
+
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('myGroupKey', 'commercial');
                $this->templateVariableContainer->expects($this->at(1))->method('add')->with('products', array('photoshop' => $photoshop, 'office' => $office));
                $this->templateVariableContainer->expects($this->at(2))->method('remove')->with('myGroupKey');
@@ -91,6 +98,7 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $this->templateVariableContainer->expects($this->at(5))->method('add')->with('products', array('typo3' => $typo3, 'drupal' => $drupal, 'wordpress' => $wordpress));
                $this->templateVariableContainer->expects($this->at(6))->method('remove')->with('myGroupKey');
                $this->templateVariableContainer->expects($this->at(7))->method('remove')->with('products');
+
                $this->viewHelper->render($products, 'products', 'license', 'myGroupKey');
        }
 
@@ -113,7 +121,9 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $wordpress = new \stdClass();
                $wordpress->name = 'Wordpress';
                $wordpress->license = 'GPL';
+
                $products = array('photoshop' => $photoshop, 'typo3' => $typo3, 'office' => $office, 'drupal' => $drupal, 'wordpress' => $wordpress);
+
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('myGroupKey', 'commercial');
                $this->templateVariableContainer->expects($this->at(1))->method('add')->with('products', array('photoshop' => $photoshop, 'office' => $office));
                $this->templateVariableContainer->expects($this->at(2))->method('remove')->with('myGroupKey');
@@ -122,6 +132,7 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $this->templateVariableContainer->expects($this->at(5))->method('add')->with('products', array('typo3' => $typo3, 'drupal' => $drupal, 'wordpress' => $wordpress));
                $this->templateVariableContainer->expects($this->at(6))->method('remove')->with('myGroupKey');
                $this->templateVariableContainer->expects($this->at(7))->method('remove')->with('products');
+
                $this->viewHelper->render($products, 'products', 'license', 'myGroupKey');
        }
 
@@ -131,12 +142,16 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
        public function renderGroupsMultidimensionalArrayByObjectKey() {
                $customer1 = new \stdClass();
                $customer1->name = 'Anton Abel';
+
                $customer2 = new \stdClass();
                $customer2->name = 'Balthasar Bux';
+
                $invoice1 = array('date' => new \DateTime('1980-12-13'), 'customer' => $customer1);
                $invoice2 = array('date' => new \DateTime('2010-07-01'), 'customer' => $customer1);
                $invoice3 = array('date' => new \DateTime('2010-07-04'), 'customer' => $customer2);
+
                $invoices = array('invoice1' => $invoice1, 'invoice2' => $invoice2, 'invoice3' => $invoice3);
+
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('myGroupKey', $customer1);
                $this->templateVariableContainer->expects($this->at(1))->method('add')->with('invoices', array('invoice1' => $invoice1, 'invoice2' => $invoice2));
                $this->templateVariableContainer->expects($this->at(2))->method('remove')->with('myGroupKey');
@@ -145,6 +160,7 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $this->templateVariableContainer->expects($this->at(5))->method('add')->with('invoices', array('invoice3' => $invoice3));
                $this->templateVariableContainer->expects($this->at(6))->method('remove')->with('myGroupKey');
                $this->templateVariableContainer->expects($this->at(7))->method('remove')->with('invoices');
+
                $this->viewHelper->render($invoices, 'invoices', 'customer', 'myGroupKey');
        }
 
@@ -154,14 +170,19 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
        public function renderGroupsMultidimensionalArrayByPropertyPath() {
                $customer1 = new \stdClass();
                $customer1->name = 'Anton Abel';
+
                $customer2 = new \stdClass();
                $customer2->name = 'Balthasar Bux';
+
                $invoice1 = new \stdClass();
                $invoice1->customer = $customer1;
+
                $invoice2 = new \stdClass();
                $invoice2->customer = $customer1;
+
                $invoice3 = new \stdClass();
                $invoice3->customer = $customer2;
+
                $invoices = array('invoice1' => $invoice1, 'invoice2' => $invoice2, 'invoice3' => $invoice3);
                $groupBy = 'customer.name';
                /** @var \TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\TYPO3\CMS\Fluid\ViewHelpers\GroupedForViewHelper $accessibleMock */
@@ -190,18 +211,24 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
        public function renderGroupsMultidimensionalObjectByObjectKey() {
                $customer1 = new \stdClass();
                $customer1->name = 'Anton Abel';
+
                $customer2 = new \stdClass();
                $customer2->name = 'Balthasar Bux';
+
                $invoice1 = new \stdClass();
                $invoice1->date = new \DateTime('1980-12-13');
                $invoice1->customer = $customer1;
+
                $invoice2 = new \stdClass();
                $invoice2->date = new \DateTime('2010-07-01');
                $invoice2->customer = $customer1;
+
                $invoice3 = new \stdClass();
                $invoice3->date = new \DateTime('2010-07-04');
                $invoice3->customer = $customer2;
+
                $invoices = array('invoice1' => $invoice1, 'invoice2' => $invoice2, 'invoice3' => $invoice3);
+
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('myGroupKey', $customer1);
                $this->templateVariableContainer->expects($this->at(1))->method('add')->with('invoices', array('invoice1' => $invoice1, 'invoice2' => $invoice2));
                $this->templateVariableContainer->expects($this->at(2))->method('remove')->with('myGroupKey');
@@ -210,6 +237,7 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $this->templateVariableContainer->expects($this->at(5))->method('add')->with('invoices', array('invoice3' => $invoice3));
                $this->templateVariableContainer->expects($this->at(6))->method('remove')->with('myGroupKey');
                $this->templateVariableContainer->expects($this->at(7))->method('remove')->with('invoices');
+
                $this->viewHelper->render($invoices, 'invoices', 'customer', 'myGroupKey');
        }
 
@@ -254,11 +282,14 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
                $photoshop = array('name' => 'Adobe Photoshop', 'license' => 'commercial');
                $typo3 = array('name' => 'TYPO3', 'license' => 'GPL');
                $office = array('name' => 'Microsoft Office', 'license' => 'commercial');
+
                $products = array('photoshop' => $photoshop, 'typo3' => $typo3, 'office' => $office);
+
                $this->templateVariableContainer->expects($this->at(0))->method('add')->with('groupKey', NULL);
                $this->templateVariableContainer->expects($this->at(1))->method('add')->with('innerKey', $products);
                $this->templateVariableContainer->expects($this->at(2))->method('remove')->with('groupKey');
                $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('innerKey');
+
                $this->viewHelper->render($products, 'innerKey', 'NonExistingKey');
        }
 
@@ -268,6 +299,7 @@ class GroupedForViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\V
         */
        public function renderThrowsExceptionWhenPassingOneDimensionalArraysToEach() {
                $values = array('some', 'simple', 'array');
+
                $this->viewHelper->render($values, 'innerVariable', 'someKey');
        }
 }
index 2a96af3..970b957 100644 (file)
@@ -2,7 +2,7 @@
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
 
 /*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  *                                                                        *
  * It is free software; you can redistribute it and/or modify it under    *
  * the terms of the GNU Lesser General Public License, either version 3   *
@@ -10,7