* Raised Extbase and Fluid versions to 1.2.0RC1.
authorSebastian Kurfürst <sebastian.kurfuerst@typo3.org>
Fri, 18 Jun 2010 11:10:30 +0000 (11:10 +0000)
committerSebastian Kurfürst <sebastian.kurfuerst@typo3.org>
Fri, 18 Jun 2010 11:10:30 +0000 (11:10 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7959 709f56b5-9817-0410-a4d7-c38de5d9e867

56 files changed:
ChangeLog
typo3/sysext/extbase/Classes/Dispatcher.php
typo3/sysext/extbase/Classes/MVC/Controller/ActionController.php
typo3/sysext/extbase/Classes/MVC/Request.php
typo3/sysext/extbase/Classes/MVC/Web/Request.php
typo3/sysext/extbase/Classes/MVC/Web/Response.php
typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php
typo3/sysext/extbase/Classes/Persistence/Mapper/ColumnMap.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapFactory.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php
typo3/sysext/extbase/Classes/Property/Mapper.php
typo3/sysext/extbase/Classes/Security/Channel/RequestHashService.php
typo3/sysext/extbase/Classes/Utility/Localization.php
typo3/sysext/extbase/Tests/MVC/Controller/ActionController_testcase.php
typo3/sysext/extbase/Tests/MVC/Web/RequestTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Persistence/Mapper/DataMapFactory_testcase.php
typo3/sysext/extbase/Tests/Security/Channel/RequestHashService_testcase.php
typo3/sysext/extbase/Tests/SeleniumBaseTestCase.php [new file with mode: 0644]
typo3/sysext/extbase/ext_autoload.php
typo3/sysext/extbase/ext_emconf.php
typo3/sysext/extbase/ext_localconf.php
typo3/sysext/extbase/ext_tables.php
typo3/sysext/fluid/Classes/Core/Parser/Configuration.php
typo3/sysext/fluid/Classes/Core/Parser/Interceptor/Escape.php
typo3/sysext/fluid/Classes/Core/Parser/InterceptorInterface.php
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/AbstractNode.php
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/ArrayNode.php
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/RenderingContextAwareInterface.php [new file with mode: 0644]
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/RootNode.php
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/ViewHelperNode.php
typo3/sysext/fluid/Classes/Core/Parser/TemplateParser.php
typo3/sysext/fluid/Classes/Core/Rendering/RenderingContext.php
typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php
typo3/sysext/fluid/Classes/Core/ViewHelper/Arguments.php
typo3/sysext/fluid/Classes/Core/ViewHelper/Exception/InvalidVariableException.php [new file with mode: 0644]
typo3/sysext/fluid/Classes/Core/ViewHelper/TemplateVariableContainer.php
typo3/sysext/fluid/Classes/Core/ViewHelper/ViewHelperVariableContainer.php
typo3/sysext/fluid/Classes/View/Exception/InvalidSectionException.php [new file with mode: 0644]
typo3/sysext/fluid/Classes/View/TemplateView.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/CheckboxViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/SelectViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Format/CropViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/RenderViewHelper.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/ViewHelperNodeComparatorTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/ViewHelperNodeTest.php
typo3/sysext/fluid/Tests/Unit/Core/Rendering/RenderingContextTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.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/TemplateViewTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/ErrorsViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Persistence/IdentityViewHelperTest.php [new file with mode: 0644]
typo3/sysext/fluid/ext_autoload.php
typo3/sysext/fluid/ext_emconf.php

index 9c6bdbe..e39b77e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-18  Sebastian Kurfuerst  <sebastian@typo3.org>
+
+       * Raised Extbase and Fluid versions to 1.2.0RC1
+
 2010-06-18  Francois Suter  <francois@typo3.org>
 
        * Fixed bug #14774: Scheduler: Improve documentation with various advice for developers
index 4d051e3..27b6930 100644 (file)
@@ -112,6 +112,7 @@ class Tx_Extbase_Dispatcher {
                if (isset($this->cObj->data) && is_array($this->cObj->data)) {
                        // we need to check the above conditions as cObj is not available in Backend.
                        $request->setContentObjectData($this->cObj->data);
+                       $request->setIsCached($this->cObj->getUserObjectType() == tslib_cObj::OBJECTTYPE_USER);
                }
                $response = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Response');
 
@@ -143,14 +144,10 @@ class Tx_Extbase_Dispatcher {
 
                self::$reflectionService->shutdown();
                
-               if (substr($response->getStatus(), 0, 3) === '303') {
-                       $response->sendHeaders();
-                       exit;
-               }
-
                if (count($response->getAdditionalHeaderData()) > 0) {
                        $GLOBALS['TSFE']->additionalHeaderData[$request->getControllerExtensionName()] = implode("\n", $response->getAdditionalHeaderData());
                }
+               $response->sendHeaders();
                $this->timeTrackPull();
                return $response->getContent();
        }
@@ -197,7 +194,7 @@ class Tx_Extbase_Dispatcher {
                } catch (t3lib_cache_exception_NoSuchCache $exception) {
                        $GLOBALS['typo3CacheFactory']->create(
                                'cache_extbase_reflection',
-                               't3lib_cache_frontend_VariableFrontend',
+                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'],
                                $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'],
                                $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options']
                        );
index 19c0675..e253248 100644 (file)
@@ -202,9 +202,9 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
        }
 
        /**
-        * Determines the action method and assures that the method exists.
+        * Resolves and checks the current action method name
         *
-        * @return string The action method name
+        * @return string Method name of the current action
         * @throws Tx_Extbase_MVC_Exception_NoSuchAction if the action specified in the request object does not exist (and if there's no default action either).
         */
        protected function resolveActionMethodName() {
index 6a3fa7d..d8c8c90 100644 (file)
@@ -212,7 +212,7 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
        /**
         * Sets the name of the action contained in this request.
         *
-        * Note that the action name must start with a lower case letter.
+        * Note that the action name must start with a lower case letter and is case sensitive.
         *
         * @param string $actionName: Name of the action to execute by the controller
         * @return void
@@ -233,6 +233,16 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
         * @api
         */
        public function getControllerActionName() {
+               $controllerObjectName = $this->getControllerObjectName();
+               if ($controllerObjectName !== '' && ($this->controllerActionName === strtolower($this->controllerActionName))) {
+                       $actionMethodName = $this->controllerActionName . 'Action';
+                       foreach (get_class_methods($controllerObjectName) as $existingMethodName) {
+                               if (strtolower($existingMethodName) === strtolower($actionMethodName)) {
+                                       $this->controllerActionName = substr($existingMethodName, 0, -6);
+                                       break;
+                               }
+                       }
+               }
                return $this->controllerActionName;
        }
 
index 1c41d8b..6768bbb 100755 (executable)
@@ -68,6 +68,11 @@ class Tx_Extbase_MVC_Web_Request extends Tx_Extbase_MVC_Request {
        protected $contentObjectData = array();
 
        /**
+        * @var boolean TRUE if the current request is cached, false otherwise.
+        */
+       protected $isCached = FALSE;
+
+       /**
         * Sets the request method
         *
         * @param string $method Name of the request method
@@ -175,5 +180,23 @@ class Tx_Extbase_MVC_Web_Request extends Tx_Extbase_MVC_Request {
        public function getContentObjectData() {
                return $this->contentObjectData;
        }
+       
+       /**
+        * Set if the current request is cached.
+        * 
+        * @param boolean $isCached
+        */
+       public function setIsCached($isCached) {
+               $this->isCached = (boolean) $isCached;
+       } 
+       /**
+        * Return whether the current request is a cached request or not.
+        * 
+        * @api (v4 only)
+        * @return boolean the caching status.
+        */
+       public function isCached() {
+               return $this->isCached;
+       }
 }
 ?>
\ No newline at end of file
index c3c13eb..9a82473 100755 (executable)
@@ -55,7 +55,7 @@ class Tx_Extbase_MVC_Web_Response extends Tx_Extbase_MVC_Response {
         *
         * @var integer
         */
-       protected $statusCode = 200;
+       protected $statusCode;
 
        /**
         * The HTTP status message
@@ -169,10 +169,11 @@ class Tx_Extbase_MVC_Web_Response extends Tx_Extbase_MVC_Response {
         */
        public function getHeaders() {
                $preparedHeaders = array();
-               $protocolVersion = (isset($_SERVER['SERVER_PROTOCOL'])) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
-               $statusHeader = $protocolVersion . ' ' . $this->statusCode . ' ' . $this->statusMessage;
-
-               $preparedHeaders[] = $statusHeader;
+               if ($this->statusCode !== NULL) {
+                       $protocolVersion = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
+                       $statusHeader = $protocolVersion . ' ' . $this->statusCode . ' ' . $this->statusMessage;
+                       $preparedHeaders[] = $statusHeader;
+               }
                foreach ($this->headers as $name => $values) {
                        foreach ($values as $value) {
                                $preparedHeaders[] = $name . ': ' . $value;
index 4b1b60d..470bb45 100644 (file)
@@ -235,6 +235,14 @@ class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_Ob
                $this->initialize();
                return parent::valid();
        }
+       
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::toArray
+        */
+       public function toArray() {
+               $this->initialize();
+               return parent::toArray();
+       }
                
 }
 ?>
\ No newline at end of file
index 6169388..b5a7455 100644 (file)
@@ -78,13 +78,6 @@ class Tx_Extbase_Persistence_Mapper_ColumnMap {
        protected $typeOfRelation;
 
        /**
-        * The type of value
-        *
-        * @var int
-        **/
-       protected $propertyType;
-
-       /**
         * The name of the child's class
         *
         * @var string
index 6d54f69..ca13337 100644 (file)
@@ -55,6 +55,10 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory {
         * @return Tx_Extbase_Persistence_Mapper_DataMap The data map
         */
        public function buildDataMap($className) {
+               if (!class_exists($className)) {
+                       throw new Tx_Extbase_Persistence_Exception_InvalidClass('Could not find class definition for name "' . $className . '". This could be caused by a mis-spelling of the class name in the class definition.');
+               }
+
                $recordType = NULL;
                $subclasses = array();
                $tableName = strtolower($className);
@@ -72,7 +76,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory {
                        if (isset($classSettings['mapping']['tableName']) && strlen($classSettings['mapping']['tableName']) > 0) {
                                $tableName = $classSettings['mapping']['tableName'];
                        }
-                       $classHierachy = array($className) + class_parents($className);
+                       $classHierachy = array_merge(array($className), class_parents($className));
                        foreach ($classHierachy as $currentClassName) {
                                if (in_array($currentClassName, array('Tx_Extbase_DomainObject_AbstractEntity', 'Tx_Extbase_DomainObject_AbstractValueObject'))) {
                                        break;
@@ -172,7 +176,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory {
         * @return void
         */
        protected function setRelations(Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap, $columnConfiguration, $propertyMetaData) {
-               if (isset($columnConfiguration) && $columnConfiguration['type'] !== 'passthrough') {
+               if (isset($columnConfiguration)) {
                        if (isset($propertyMetaData['elementType'])) {
                                if (isset($columnConfiguration['MM']) || isset($columnConfiguration['foreign_selector'])) {
                                        $columnMap = $this->setManyToManyRelation($columnMap, $columnConfiguration);
index 001f948..0f8aab1 100644 (file)
@@ -360,7 +360,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                                $query->setOrderings(array($columnMap->getChildSortByFieldName() => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
                        }
                } else {
-                       throw new Tx_Extbase_Persistence_Exception('Could not determine type of relation for the property "' . $propertyName . '". This is mainly caused by a missing type declaration above the property definition.', 1252502725);
+                       throw new Tx_Extbase_Persistence_Exception('Could not determine type of relation for the property "' . $propertyName . '". This is mainly caused by a missing type declaration above the property definition. If the PHPDoc comment is there, make sure it starts with "/**" and not just with "/*".', 1252502725);
                }
                $query->matching($this->getConstraint($query, $parentObject, $propertyName, $fieldValue, $columnMap->getRelationTableMatchFields()));
                return $query;
index 91954fa..1a879dd 100644 (file)
@@ -114,7 +114,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $this->replacePlaceholders($sqlString, $parameters);
                // debug($sqlString,-2);
                $this->databaseHandle->sql_query($sqlString);
-               $this->checkSqlErrors();
+               $this->checkSqlErrors($sqlString);
                $uid = $this->databaseHandle->sql_insert_id();
                if (!$isRelation) {
                        $this->clearPageCache($tableName, $uid);
@@ -146,7 +146,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $this->replacePlaceholders($sqlString, $parameters);
                // debug($sqlString,-2);
                $returnValue = $this->databaseHandle->sql_query($sqlString);
-               $this->checkSqlErrors();
+               $this->checkSqlErrors($sqlString);
                if (!$isRelation) {
                        $this->clearPageCache($tableName, $uid);
                }
@@ -169,7 +169,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                }
                // debug($statement, -2);
                $returnValue = $this->databaseHandle->sql_query($statement);
-               $this->checkSqlErrors();
+               $this->checkSqlErrors($statement);
                return $returnValue;
        }
 
@@ -185,7 +185,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $this->replacePlaceholders($statement, $identifier);
                // debug($statement,-2);
                $res = $this->databaseHandle->sql_query($statement);
-               $this->checkSqlErrors();
+               $this->checkSqlErrors($statement);
                $row = $this->databaseHandle->sql_fetch_assoc($res);
                if ($row !== FALSE) {
                        return $row;
@@ -225,7 +225,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $this->replacePlaceholders($sql, $parameters);
                // debug($sql,-2);
                $result = $this->databaseHandle->sql_query($sql);
-               $this->checkSqlErrors();
+               $this->checkSqlErrors($sql);
                $rows = $this->getRowsFromResult($query->getSource(), $result);
                $rows = $this->doLanguageAndWorkspaceOverlay($query->getSource(), $rows);
                // TODO: implement $objectData = $this->processObjectRecords($statementHandle);
@@ -246,9 +246,9 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $statementParts['fields'] = array('COUNT(*)');
                $statement = $this->buildQuery($statementParts, $parameters);
                $this->replacePlaceholders($statement, $parameters);
-               // debug($sql,-2);
+               // debug($statement,-2);
                $result = $this->databaseHandle->sql_query($statement);
-               $this->checkSqlErrors();
+               $this->checkSqlErrors($statement);
                $rows = $this->getRowsFromResult($query->getSource(), $result);
                return current(current($rows));
        }
@@ -277,7 +277,8 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $this->parseOrderings($query->getOrderings(), $source, $sql);
                $this->parseLimitAndOffset($query->getLimit(), $query->getOffset(), $sql);
 
-               foreach (array_keys($sql['tables']) as $tableName) {
+               $tableNames = array_unique(array_keys($sql['tables'] + $sql['unions']));
+               foreach ($tableNames as $tableName) {
                        if (is_string($tableName) && strlen($tableName) > 0) {
                                $this->addAdditionalWhereClause($query->getQuerySettings(), $tableName, $sql);
                        }
@@ -347,7 +348,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $this->replacePlaceholders($statement, $parameters);
                // debug($statement,-2);
                $res = $this->databaseHandle->sql_query($statement);
-               $this->checkSqlErrors();
+               $this->checkSqlErrors($statement);
                $row = $this->databaseHandle->sql_fetch_assoc($res);
                if ($row !== FALSE) {
                        return (int)$row['uid'];
@@ -957,11 +958,13 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
         * Checks if there are SQL errors in the last query, and if yes, throw an exception.
         *
         * @return void
+        * @param string $sql The SQL statement
         * @throws Tx_Extbase_Persistence_Storage_Exception_SqlError
         */
-       protected function checkSqlErrors() {
+       protected function checkSqlErrors($sql='') {
                $error = $this->databaseHandle->sql_error();
                if ($error !== '') {
+                       $error .= $sql ? ': ' . $sql : '';
                        throw new Tx_Extbase_Persistence_Storage_Exception_SqlError($error, 1247602160);
                }
        }
index 7cc6d9e..5644b7f 100644 (file)
@@ -198,10 +198,12 @@ class Tx_Extbase_Property_Mapper {
                                if ($targetClassSchema !== NULL && $targetClassSchema->hasProperty($propertyName)) {
                                        $propertyMetaData = $targetClassSchema->getProperty($propertyName);
 
-                                       if (in_array($propertyMetaData['type'], array('array', 'ArrayObject', 'Tx_Extbase_Persistence_ObjectStorage')) && strpos($propertyMetaData['elementType'], '_') !== FALSE) {
+                                       if (in_array($propertyMetaData['type'], array('array', 'ArrayObject', 'Tx_Extbase_Persistence_ObjectStorage')) && (strpos($propertyMetaData['elementType'], '_') !== FALSE || $propertyValue === '')) {
                                                $objects = array();
-                                               foreach ($propertyValue as $value) {
-                                                       $objects[] = $this->transformToObject($value, $propertyMetaData['elementType'], $propertyName);
+                                               if (is_array($propertyValue)) {
+                                                       foreach ($propertyValue as $value) {
+                                                               $objects[] = $this->transformToObject($value, $propertyMetaData['elementType'], $propertyName);
+                                                       }
                                                }
 
                                                        // make sure we hand out what is expected
index 5d49a36..4d52780 100644 (file)
@@ -172,6 +172,16 @@ class Tx_Extbase_Security_Channel_RequestHashService implements t3lib_singleton
                                }
                        } elseif (!is_array($requestArguments[$argumentName]) && !is_array($allowedFields[$argumentName])) {
                                // do nothing, as this is allowed
+                       } elseif (!is_array($requestArguments[$argumentName]) && $requestArguments[$argumentName] === '' && is_array($allowedFields[$argumentName])) {
+                               // do nothing, as this is allowed.
+                               // This case is needed for making an array of checkboxes work, in case they are fully unchecked.
+                               // Example: if the following checkbox names are defined:
+                               //     foo[a]
+                               //     foo[b]
+                               // then, Fluid automatically renders a hidden field "foo" with the value '' (empty string) in front of it,
+                               // to determine the case if the user un-checks all checkboxes.
+                               // in this case, the property mapping already does the right thing, but without this condition here,
+                               // the request hash checking would fail because of the strong type checks.
                        } else {
                                // different types - error
                                return FALSE;
index 5107320..8f230cb 100644 (file)
@@ -138,7 +138,7 @@ class Tx_Extbase_Utility_Localization {
                if (isset(self::$LOCAL_LANG[$extensionName])) {
                        return;
                }
-               $locallangPathAndFilename = t3lib_extMgm::extPath(t3lib_div::camelCaseToLowerCaseUnderscored($extensionName), self::$locallangPath . 'locallang.php');
+               $locallangPathAndFilename = 'EXT:' . t3lib_div::camelCaseToLowerCaseUnderscored($extensionName) . '/' . self::$locallangPath . 'locallang.xml';
 
                self::setLanguageKeys();
 
index da49545..7c4265b 100644 (file)
@@ -214,6 +214,35 @@ class Tx_Extbase_MVC_Controller_ActionController_testcase extends Tx_Extbase_Bas
         * @test
         * @author Robert Lemke <robert@typo3.org>
         */
+       public function resolveActionMethodNameReturnsTheCurrentActionMethodNameFromTheRequest() {
+               $mockRequest = $this->getMock('Tx_Extbase_MVC_RequestInterface', array(), array(), '', FALSE);
+               $mockRequest->expects($this->once())->method('getControllerActionName')->will($this->returnValue('fooBar'));
+
+               $mockController = $this->getAccessibleMock('Tx_Extbase_MVC_Controller_ActionController', array('fooBarAction'), array(), '', FALSE);
+               $mockController->_set('request', $mockRequest);
+
+               $this->assertEquals('fooBarAction', $mockController->_call('resolveActionMethodName'));
+       }
+
+       /**
+        * @test
+        * @expectedException Tx_Extbase_MVC_Exception_NoSuchAction
+        * @author Robert Lemke <robert@typo3.org>
+        */
+       public function resolveActionMethodNameThrowsAnExceptionIfTheActionDefinedInTheRequestDoesNotExist() {
+               $mockRequest = $this->getMock('Tx_Extbase_MVC_RequestInterface', array(), array(), '', FALSE);
+               $mockRequest->expects($this->once())->method('getControllerActionName')->will($this->returnValue('fooBar'));
+
+               $mockController = $this->getAccessibleMock('Tx_Extbase_MVC_Controller_ActionController', array('otherBarAction'), array(), '', FALSE);
+               $mockController->_set('request', $mockRequest);
+
+               $mockController->_call('resolveActionMethodName');
+       }
+
+       /**
+        * @test
+        * @author Robert Lemke <robert@typo3.org>
+        */
        public function initializeActionMethodArgumentsRegistersArgumentsFoundInTheSignatureOfTheCurrentActionMethod() {
                $mockRequest = $this->getMock('Tx_Extbase_MVC_RequestInterface', array(), array(), '', FALSE);
 
diff --git a/typo3/sysext/extbase/Tests/MVC/Web/RequestTest.php b/typo3/sysext/extbase/Tests/MVC/Web/RequestTest.php
new file mode 100644 (file)
index 0000000..f18ae1d
--- /dev/null
@@ -0,0 +1,46 @@
+<?php 
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Sebastian Kurfuerst <sebastian@typo3.org>
+*  All rights reserved
+*
+*  This class is a backport of the corresponding class of FLOW3.
+*  All credits go to the v5 team.
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+class Tx_Extbase_MVC_Web_RequestTest extends Tx_Extbase_BaseTestCase {
+       /**
+        * @test
+        */
+       public function isCachedReturnsFalseByDefault() {
+               $request = new Tx_Extbase_MVC_Web_Request();
+               $this->assertFalse($request->isCached());
+       }
+
+       /**
+        * @test
+        */
+       public function isCachedReturnsTheValueWhichWasPreviouslySet() {
+               $request = new Tx_Extbase_MVC_Web_Request();
+               $request->setIsCached(TRUE);
+               $this->assertTrue($request->isCached());
+       }
+}
+?>
\ No newline at end of file
index 0bfe5c7..a3442c3 100644 (file)
@@ -310,5 +310,14 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory_testcase extends Tx_Extbase_B
                $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
        }
        
+       /**
+        * @test
+        * @expectedException Tx_Extbase_Persistence_Exception_InvalidClass
+        */
+       public function buildDataMapThrowsExceptionIfClassNameIsNotKnown() {
+               $mockDataMapFactory = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Persistence_Mapper_DataMapFactory'), array('getControlSection'), array(), '', FALSE);
+               $mockDataMapFactory->buildDataMap('UnknownObject');
+       }
+       
 }
 ?>
\ No newline at end of file
index f6e8885..fe548de 100644 (file)
@@ -389,6 +389,28 @@ class Tx_Extbase_Security_Channel_RequestHashService_testcase extends Tx_Extbase
                                // Expected result
                                FALSE
                        ),
+                       
+                       // hierarchical fields with requestfields != responsefields (different types)
+                       // This case happens if an array of checkboxes is rendered, in case they are fully unchecked.
+                       array(
+                               // Request
+                               array(
+                                       'a' => '', // this is the only allowed value.
+                                       'b' => 'X',
+                                       'c' => 'X'
+                               ),
+                               // Allowed
+                               array(
+                                       'a' => array(
+                                               'x' => 1,
+                                               'y' => 1
+                                       ),
+                                       'b' => 1,
+                                       'c' => 1
+                               ),
+                               // Expected result
+                               TRUE
+                       ),
                );
        }
 
diff --git a/typo3/sysext/extbase/Tests/SeleniumBaseTestCase.php b/typo3/sysext/extbase/Tests/SeleniumBaseTestCase.php
new file mode 100644 (file)
index 0000000..0054663
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Bastian Waidelich <bastian@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+require_once(t3lib_extMgm::extPath('phpunit') . 'class.tx_phpunit_selenium_testcase.php');
+
+/**
+ * Base Selenium testcase for the Extbase extension.
+ */
+abstract class Tx_Extbase_SeleniumBaseTestCase extends tx_phpunit_selenium_testcase {
+
+}
+?>
index a1023e8..9a99fbb 100644 (file)
@@ -6,6 +6,7 @@ $extensionClassesPath = t3lib_extMgm::extPath('extbase') . 'Classes/';
 $extensionTestsPath = t3lib_extMgm::extPath('extbase') . 'Tests/';
 return array(
        'tx_extbase_basetestcase' => $extensionTestsPath . 'BaseTestCase.php',
+       'tx_extbase_seleniumbasetestcase' => $extensionTestsPath . 'SeleniumBaseTestCase.php',
        'tx_extbase_dispatcher' => $extensionClassesPath . 'Dispatcher.php',
        'tx_extbase_exception' => $extensionClassesPath . 'Exception.php',
        'tx_extbase_configuration_abstractconfigurationmanager' => $extensionClassesPath . 'Configuration/AbstractConfigurationManager.php',
index e65f73e..687e00a 100644 (file)
@@ -29,7 +29,7 @@ $EM_CONF[$_EXTKEY] = array(
        'clearCacheOnLoad' => 1,
        'lockType' => '',
        'author_company' => 'TYPO3 core team',
-       'version' => '1.2.0beta2',
+       'version' => '1.2.0RC1',
        'constraints' => array(
                'depends' => array(
                        'php' => '5.2.0-0.0.0',
index af00d3f..be4ecaa 100644 (file)
@@ -6,6 +6,7 @@ require_once(t3lib_extMgm::extPath('extbase') . 'Classes/Utility/Extension.php')
 
 // use own cache table
 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection'] = array(
+       'frontend' => 't3lib_cache_frontend_VariableFrontend',
        'backend' => 't3lib_cache_backend_DbBackend',
        'options' => array(
                'cacheTable' => 'tx_extbase_cache_reflection',
index c0f2d98..ba41b73 100644 (file)
@@ -9,7 +9,7 @@ if (TYPO3_MODE == 'BE') {
                t3lib_cache::initializeCachingFramework();
                $GLOBALS['typo3CacheFactory']->create(
                        'tx_extbase_cache_reflection',
-                       't3lib_cache_frontend_VariableFrontend',
+                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'],
                        $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'],
                        $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options']
                );
index deaf281..456b58a 100644 (file)
@@ -24,7 +24,7 @@
  * The parser configuration. Contains all configuration needed to configure
  * the building of a SyntaxTree.
  *
- * @version $Id: Configuration.php 3952 2010-03-16 08:00:53Z sebastian $
+ * @version $Id: Configuration.php 4269 2010-05-05 10:03:16Z robert $
  * @package Fluid
  * @subpackage Core\Parser
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
@@ -84,12 +84,12 @@ class Tx_Fluid_Core_Parser_Configuration {
        /**
         * Returns all interceptors for a given Interception Point.
         *
-        * @param int $inerceptionPoint one of the Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_* constants,
+        * @param int $interceptionPoint one of the Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_* constants,
         * @return \SplObjectStorage<Tx_Fluid_Core_Parser_InterceptorInterface>
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
        public function getInterceptors($interceptionPoint) {
-               if ($this->interceptors[$interceptionPoint] instanceof SplObjectStorage) {
+               if (isset($this->interceptors[$interceptionPoint]) && $this->interceptors[$interceptionPoint] instanceof SplObjectStorage) {
                        return $this->interceptors[$interceptionPoint];
                }
                return new SplObjectStorage();
index 1ded12a..8d65999 100644 (file)
@@ -23,7 +23,7 @@
 /**
  * An interceptor adding the escape viewhelper to the suitable places.
  *
- * @version $Id: Escape.php 3953 2010-03-16 08:08:17Z sebastian $
+ * @version $Id: Escape.php 4040 2010-04-08 16:02:57Z k-fish $
  * @package Fluid
  * @subpackage Core\Parser\Interceptor
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
@@ -60,7 +60,7 @@ class Tx_Fluid_Core_Parser_Interceptor_Escape implements Tx_Fluid_Core_Parser_In
         * If "escapingInterceptorEnabled" in the ViewHelper is FALSE, will disable itself inside the ViewHelpers body.
         *
         * @param Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface $node
-        * @param int One of the INTERCEPT_* constants for the current interception point
+        * @param integer $interceptorPosition One of the INTERCEPT_* constants for the current interception point
         * @return Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface
         * @author Karsten Dambekalns <karsten@typo3.org>
         * @author Sebastian Kurfürst <sebastian@typo3.org>
index afd5eb7..cd0d050 100644 (file)
@@ -24,7 +24,7 @@
  * An interceptor interface. Interceptors are used in the parsing stage to change
  * the syntax tree of a template, e.g. by adding viewhelper nodes.
  *
- * @version $Id: InterceptorInterface.php 3952 2010-03-16 08:00:53Z sebastian $
+ * @version $Id: InterceptorInterface.php 4004 2010-03-23 14:11:29Z k-fish $
  * @package Fluid
  * @subpackage Core\Parser
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
@@ -41,7 +41,7 @@ interface Tx_Fluid_Core_Parser_InterceptorInterface {
         * that will be used in place of the given node.
         *
         * @param Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface $node
-        * @param int One of the INTERCEPT_* constants for the current interception point
+        * @param integer $interceptorPosition One of the INTERCEPT_* constants for the current interception point
         * @return Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface
         */
        public function process(Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface $node, $interceptorPosition);
index d5ab5ef..6b2b63f 100644 (file)
@@ -72,8 +72,9 @@ abstract class Tx_Fluid_Core_Parser_SyntaxTree_AbstractNode implements Tx_Fluid_
                                }
                                $output = (string)$output;
                                $subNodeOutput = $subNode->evaluate();
+
                                if (is_object($subNodeOutput) && !method_exists($subNodeOutput, '__toString')) {
-                                       throw new Tx_Fluid_Core_Parser_Exception('Cannot cast object of type "' . get_class($subNodeOutput) . '" to string.', 1248356140);
+                                       throw new Tx_Fluid_Core_Parser_Exception('Cannot cast object of type "' . get_class($subNodeOutput) . '" to string.', 1273753083);
                                }
                                $output .= (string)$subNodeOutput;
                        }
index 52a22ee..91a32fc 100644 (file)
@@ -56,7 +56,7 @@ class Tx_Fluid_Core_Parser_SyntaxTree_ArrayNode extends Tx_Fluid_Core_Parser_Syn
         */
        public function evaluate() {
                if ($this->renderingContext === NULL) {
-                       throw new RuntimeException('Rendering Context is null in ArrayNode, but necessary. If this error appears, please report a bug!', 1242668976);
+                       throw new Tx_Fluid_Core_Parser_Exception('Rendering Context is null in ArrayNode, but necessary. If this error appears, please report a bug!', 1242668976);
                }
                $arrayToBuild = array();
                foreach ($this->internalArray as $key => $value) {
diff --git a/typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/RenderingContextAwareInterface.php b/typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/RenderingContextAwareInterface.php
new file mode 100644 (file)
index 0000000..2e0e22a
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+/*                                                                        *
+ * This script belongs to the FLOW3 package "Fluid".                      *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * Interface for objects which are aware of Fluid's rendering context. All objects
+ * marked with this interface will get the current rendering context injected
+ * by the ObjectAccessorNode on trying to evaluate them.
+ *
+ * @version $Id$
+ * @package Fluid
+ * @subpackage Core\Parser\SyntaxTree
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+interface Tx_Fluid_Core_Parser_SyntaxTree_RenderingContextAwareInterface {
+
+       /**
+        * Sets the current rendering context
+        *
+        * @param $renderingContext
+        * @return void
+        */
+       public function setRenderingContext($renderingContext);
+
+}
+
+?>
\ No newline at end of file
index 3fefbfc..f98ea73 100644 (file)
@@ -39,10 +39,10 @@ class Tx_Fluid_Core_Parser_SyntaxTree_RootNode extends Tx_Fluid_Core_Parser_Synt
         */
        public function evaluate() {
                if ($this->renderingContext === NULL) {
-                       throw new RuntimeException('Rendering Context is null in RootNode, but necessary. If this error appears, please report a bug!', 1242669004);
+                       throw new Tx_Fluid_Core_Parser_Exception('Rendering Context is NULL in RootNode, but necessary. If this error appears, please report a bug!', 1242669004);
                }
-               $text = $this->evaluateChildNodes();
-               return $text;
+               $result = $this->evaluateChildNodes();
+               return $result;
        }
 }
 
index d343c2d..f49a5db 100644 (file)
@@ -130,7 +130,7 @@ class Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode extends Tx_Fluid_Core_Parse
         */
        public function evaluate() {
                if ($this->renderingContext === NULL) {
-                       throw new RuntimeException('RenderingContext is null in ViewHelperNode, but necessary. If this error appears, please report a bug!', 1242669031);
+                       throw new Tx_Fluid_Core_Parser_Exception('RenderingContext is null in ViewHelperNode, but necessary. If this error appears, please report a bug!', 1242669031);
                }
 
                $objectManager = $this->renderingContext->getObjectManager();
@@ -230,12 +230,13 @@ class Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode extends Tx_Fluid_Core_Parse
         *
         * @param Tx_Fluid_Core_Parser_SyntaxTree_AbstractNode $syntaxTreeNode Value to be converted
         * @return boolean Evaluated value
+        * @throws Tx_Fluid_Core_Parser_Exception
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        protected function evaluateBooleanExpression(Tx_Fluid_Core_Parser_SyntaxTree_AbstractNode $syntaxTreeNode) {
                $childNodes = $syntaxTreeNode->getChildNodes();
                if (count($childNodes) > 3) {
-                       throw new RuntimeException('The expression "' . $syntaxTreeNode->evaluate() . '" has more than tree parts.', 1244201848);
+                       throw new Tx_Fluid_Core_Parser_Exception('The expression "' . $syntaxTreeNode->evaluate() . '" has more than tree parts.', 1244201848);
                }
 
                $leftSide = NULL;
@@ -292,6 +293,7 @@ class Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode extends Tx_Fluid_Core_Parse
         * @param mixed $leftSide Left side to compare
         * @param mixed $rightSide Right side to compare
         * @return boolean TRUE if comparison of left and right side using the comparator emit TRUE, false otherwise
+        * @throws Tx_Fluid_Core_Parser_Exception
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        protected function evaluateComparator($comparator, $leftSide, $rightSide) {
@@ -313,7 +315,7 @@ class Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode extends Tx_Fluid_Core_Parse
                        case '<=':
                                return ($leftSide <= $rightSide);
                        default:
-                               throw new RuntimeException('Comparator "' . $comparator . '" was not implemented.', 1244234398);
+                               throw new Tx_Fluid_Core_Parser_Exception('Comparator "' . $comparator . '" is not implemented.', 1244234398);
                }
        }
 
index b6e2fa5..67fd1b3 100644 (file)
@@ -599,7 +599,7 @@ class Tx_Fluid_Core_Parser_TemplateParser {
         * Call all interceptors registered for a given interception point.
         *
         * @param Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface $node The syntax tree node which can be modified by the interceptors.
-        * @param int the interception point. One of the Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_* constants.
+        * @param integer $interceptionPoint the interception point. One of the Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_* constants.
         * @return void
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
index 5017a31..4ef84c2 100644 (file)
@@ -38,7 +38,7 @@ class Tx_Fluid_Core_Rendering_RenderingContext {
        protected $templateVariableContainer;
 
        /**
-        * Object factory which is bubbled through. The ViewHelperNode cannot get an ObjectManager injected because
+        * Object manager which is bubbled through. The ViewHelperNode cannot get an ObjectManager injected because
         * the whole syntax tree should be cacheable
         * @var Tx_Fluid_Compatibility_ObjectManager
         */
@@ -57,7 +57,7 @@ class Tx_Fluid_Core_Rendering_RenderingContext {
        protected $viewHelperVariableContainer;
 
        /**
-        * Inject the object factory
+        * Inject the object manager
         *
         * @param Tx_Fluid_Compatibility_ObjectManager $objectManager
         * @author Sebastian Kurfürst <sebastian@typo3.org>
@@ -67,7 +67,7 @@ class Tx_Fluid_Core_Rendering_RenderingContext {
        }
 
        /**
-        * Returns the object factory. Only the ViewHelperNode should do this.
+        * Returns the object manager. Only the ViewHelperNode should do this.
         *
         * @param Tx_Fluid_Compatibility_ObjectManager $objectManager
         * @author Sebastian Kurfürst <sebastian@typo3.org>
index 25b0ffa..789d471 100644 (file)
@@ -292,18 +292,18 @@ abstract class Tx_Fluid_Core_ViewHelper_AbstractViewHelper implements Tx_Fluid_C
 
                                if ($type === 'array') {
                                        if (!is_array($this->arguments[$argumentName]) && !$this->arguments[$argumentName] instanceof ArrayAccess && !$this->arguments[$argumentName] instanceof Traversable) {
-                                               throw new RuntimeException('The argument "' . $argumentName . '" was registered with type "array", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '". Value of argument: "' . strval($this->arguments[$argumentName]) . '"', 1237900529);
+                                               throw new InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "array", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '"', 1237900529);
                                        }
                                } elseif ($type === 'boolean') {
                                        if (!is_bool($this->arguments[$argumentName])) {
-                                               throw new RuntimeException('The argument "' . $argumentName . '" was registered with type "boolean", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1240227732);
+                                               throw new InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "boolean", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1240227732);
                                        }
-                               } elseif (class_exists($type)) {
+                               } elseif (class_exists($type, FALSE)) {
                                        if (! ($this->arguments[$argumentName] instanceof $type)) {
                                                if (is_object($this->arguments[$argumentName])) {
-                                                       throw new RuntimeException('The argument "' . $argumentName . '" was registered with type "' . $type . '", but is of type "' . get_class($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1256475114);
+                                                       throw new InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "' . $type . '", but is of type "' . get_class($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1256475114);
                                                } else {
-                                                       throw new RuntimeException('The argument "' . $argumentName . '" was registered with type "' . $type . '", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1256475113);
+                                                       throw new InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "' . $type . '", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1256475113);
                                                }
                                        }
                                }
index 0c844b6..7c76c79 100644 (file)
@@ -84,7 +84,7 @@ class Tx_Fluid_Core_ViewHelper_Arguments implements ArrayAccess {
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        public function offsetSet($key, $value) {
-               throw new RuntimeException('Tried to set argument "' . $key . '", but setting arguments is forbidden.', 1236080693);
+               throw new Tx_Fluid_Core_Exception('Tried to set argument "' . $key . '", but setting arguments is forbidden.', 1236080693);
        }
 
        /**
@@ -94,7 +94,7 @@ class Tx_Fluid_Core_ViewHelper_Arguments implements ArrayAccess {
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        public function offsetUnset($key) {
-               throw new RuntimeException('Tried to unset argument "' . $key . '", but setting arguments is forbidden.', 1236080702);
+               throw new Tx_Fluid_Core_Exception('Tried to unset argument "' . $key . '", but setting arguments is forbidden.', 1236080702);
        }
 
        /**
diff --git a/typo3/sysext/fluid/Classes/Core/ViewHelper/Exception/InvalidVariableException.php b/typo3/sysext/fluid/Classes/Core/ViewHelper/Exception/InvalidVariableException.php
new file mode 100644 (file)
index 0000000..0c88b2b
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+/*                                                                        *
+ * This script belongs to the FLOW3 package "Fluid".                      *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * A "Invalid Variable" exception.
+ *
+ * @version $Id$
+ * @package Fluid
+ * @subpackage Core\ViewHelper\Exception
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @api
+ */
+class Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException extends Tx_Fluid_Core_ViewHelper_Exception {
+}
+
+?>
\ No newline at end of file
index 8f9157f..77a6d0e 100644 (file)
@@ -34,7 +34,7 @@
  * @api
  * @scope prototype
  */
-class Tx_Fluid_Core_ViewHelper_TemplateVariableContainer {
+class Tx_Fluid_Core_ViewHelper_TemplateVariableContainer implements ArrayAccess {
 
        /**
         * List of reserved words that can't be used as variable identifiers in Fluid templates
@@ -55,8 +55,7 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainer {
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         * @api
         */
-       public function __construct($variableArray = array()) {
-               if (!is_array($variableArray)) throw new RuntimeException('Context has to be initialized with an array, ' . gettype($variableArray) . ' given.', 1224592343);
+       public function __construct(array $variableArray = array()) {
                $this->variables = $variableArray;
        }
 
@@ -71,8 +70,8 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainer {
         * @api
         */
        public function add($identifier, $value) {
-               if (array_key_exists($identifier, $this->variables)) throw new RuntimeException('Duplicate variable declarations!', 1224479063);
-               if (in_array(strtolower($identifier), self::$reservedVariableNames)) throw new RuntimeException('"' . $identifier . '" is a reserved variable name and can\'t be used as variable identifier.', 1256730379);
+               if (array_key_exists($identifier, $this->variables)) throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('Duplicate variable declarations!', 1224479063);
+               if (in_array(strtolower($identifier), self::$reservedVariableNames)) throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('"' . $identifier . '" is a reserved variable name and can\'t be used as variable identifier.', 1256730379);
                $this->variables[$identifier] = $value;
        }
 
@@ -85,7 +84,7 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainer {
         * @api
         */
        public function get($identifier) {
-               if (!array_key_exists($identifier, $this->variables)) throw new RuntimeException('Tried to get a variable "' . $identifier . '" which is not stored in the context!', 1224479370);
+               if (!array_key_exists($identifier, $this->variables)) throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('Tried to get a variable "' . $identifier . '" which is not stored in the context!', 1224479370);
                return $this->variables[$identifier];
        }
 
@@ -98,7 +97,7 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainer {
         * @api
         */
        public function remove($identifier) {
-               if (!array_key_exists($identifier, $this->variables)) throw new RuntimeException('Tried to remove a variable "' . $identifier . '" which is not stored in the context!', 1224479372);
+               if (!array_key_exists($identifier, $this->variables)) throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('Tried to remove a variable "' . $identifier . '" which is not stored in the context!', 1224479372);
                unset($this->variables[$identifier]);
        }
 
@@ -133,5 +132,50 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainer {
        public function __sleep() {
                return array('variables');
        }
+
+       /**
+        * Adds a variable to the context.
+        *
+        * @param string $identifier Identifier of the variable to add
+        * @param mixed $value The variable's value
+        * @return void
+        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        */
+       public function offsetSet($identifier, $value) {
+               return $this->add($identifier, $value);
+       }
+
+       /**
+        * Remove a variable from context. Throws exception if variable is not found in context.
+        *
+        * @param string $identifier The identifier to remove
+        * @return void
+        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        */
+       public function offsetUnset($identifier) {
+               return $this->remove($identifier);
+       }
+
+       /**
+        * Checks if this property exists in the VariableContainer.
+        *
+        * @param string $identifier
+        * @return boolean TRUE if $identifier exists, FALSE otherwise
+        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        */
+       public function offsetExists($identifier) {
+               return $this->exists($identifier);
+       }
+
+       /**
+        * Get a variable from the context. Throws exception if variable is not found in context.
+        *
+        * @param string $identifier
+        * @return variable The variable identified by $identifier
+        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        */
+       public function offsetGet($identifier) {
+               return $this->get($identifier);
+       }
 }
 ?>
\ No newline at end of file
index a813938..af0a1f0 100644 (file)
@@ -46,19 +46,19 @@ class Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer {
        /**
         * Add a variable to the Variable Container. Make sure that $viewHelperName is ALWAYS set
         * to your fully qualified ViewHelper Class Name
-        * 
+        *
         * In case the value is already inside, an exception is thrown.
         *
         * @param string $viewHelperName The ViewHelper Class name (Fully qualified, like Tx_Fluid_ViewHelpers_ForViewHelper)
         * @param string $key Key of the data
         * @param object $value The value to store
         * @return void
-        * @throws RuntimeException if there was no key with the specified name
+        * @throws Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException if there was no key with the specified name
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         * @api
         */
        public function add($viewHelperName, $key, $value) {
-               if ($this->exists($viewHelperName, $key)) throw new RuntimeException('The key "' . $viewHelperName . '->' . $key . '" was already stored and you cannot override it.', 1243352010);
+               if ($this->exists($viewHelperName, $key)) throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('The key "' . $viewHelperName . '->' . $key . '" was already stored and you cannot override it.', 1243352010);
                $this->addOrUpdate($viewHelperName, $key, $value);
        }
 
@@ -79,19 +79,19 @@ class Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer {
                }
                $this->objects[$viewHelperName][$key] = $value;
        }
-       
+
        /**
         * Gets a variable which is stored
         *
         * @param string $viewHelperName The ViewHelper Class name (Fully qualified, like Tx_Fluid_ViewHelpers_ForViewHelper)
         * @param string $key Key of the data
         * @return object The object stored
-        * @throws RuntimeException if there was no key with the specified name
+        * @throws Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException if there was no key with the specified name
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         * @api
         */
        public function get($viewHelperName, $key) {
-               if (!$this->exists($viewHelperName, $key)) throw new RuntimeException('No value found for key "' . $viewHelperName . '->' . $key . '"', 1243325768);
+               if (!$this->exists($viewHelperName, $key)) throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('No value found for key "' . $viewHelperName . '->' . $key . '"', 1243325768);
                return $this->objects[$viewHelperName][$key];
        }
 
@@ -114,12 +114,12 @@ class Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer {
         * @param string $viewHelperName The ViewHelper Class name (Fully qualified, like Tx_Fluid_ViewHelpers_ForViewHelper)
         * @param string $key Key of the data to remove
         * @return void
-        * @throws RuntimeException if there was no key with the specified name
+        * @throws Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException if there was no key with the specified name
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         * @api
         */
        public function remove($viewHelperName, $key) {
-               if (!$this->exists($viewHelperName, $key)) throw new RuntimeException('No value found for key "' . $viewHelperName . '->' . $key . '", thus the key cannot be removed.', 1243352249);
+               if (!$this->exists($viewHelperName, $key)) throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('No value found for key "' . $viewHelperName . '->' . $key . '", thus the key cannot be removed.', 1243352249);
                unset($this->objects[$viewHelperName][$key]);
        }
 
diff --git a/typo3/sysext/fluid/Classes/View/Exception/InvalidSectionException.php b/typo3/sysext/fluid/Classes/View/Exception/InvalidSectionException.php
new file mode 100644 (file)
index 0000000..15db8b8
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+/*                                                                        *
+ * This script belongs to the FLOW3 package "Fluid".                      *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * An "Invalid Section" exception
+ *
+ * @version $Id$
+ * @package Fluid
+ * @subpackage View\Exception
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @api
+ */
+class Tx_Fluid_View_Exception_InvalidSectionException extends Tx_Fluid_View_Exception {
+}
+
+?>
\ No newline at end of file
index 0e9ad8c..8fd7657 100644 (file)
@@ -219,10 +219,12 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
        }
 
        /**
-        * Resolve the template path and filename for the given action. If action is null, looks into the current request.
+        * Resolve the template path and filename for the given action. If $actionName
+        * is NULL, looks into the current request.
         *
         * @param string $actionName Name of the action. If NULL, will be taken from request.
         * @return string Full path to template
+        * @throws Tx_Fluid_View_Exception_InvalidTemplateResourceException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        protected function resolveTemplatePathAndFilename($actionName = NULL) {
@@ -231,17 +233,24 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
                }
 
                $actionName = ($actionName !== NULL ? $actionName : $this->controllerContext->getRequest()->getControllerActionName());
-               $actionName = strtolower($actionName);
+               $actionName = ucfirst($actionName);
 
                $paths = $this->expandGenericPathPattern($this->templatePathAndFilenamePattern, FALSE, FALSE);
 
                foreach ($paths as &$path) {
+                       // TODO remove fallback to lower case template files after grace period
+                       $fallbackPath = str_replace('@action', strtolower($actionName), $path);
                        $path = str_replace('@action', $actionName, $path);
                        if (file_exists($path)) {
                                return $path;
+                       } else {
+                               if (file_exists($fallbackPath)) {
+                                       t3lib_div::deprecationLog('the template filename "' . $fallbackPath . '" is lowercase. This is deprecated since TYPO3 4.4. Please rename the template to "' . basename($path) . '"');
+                                       return $fallbackPath;
+                               }
                        }
                }
-               throw new RuntimeException('The template files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
+               throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('Template could not be loaded. I tried "' . implode('", "', $paths) . '"', 1225709595);
        }
 
        /**
@@ -249,6 +258,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
         *
         * @param string $sectionName Name of section to render
         * @return string rendered template for the section
+        * @throws Tx_Fluid_View_Exception_InvalidSectionException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         * @author Bastian Waidelich <bastian@typo3.org>
         */
@@ -257,7 +267,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
 
                $sections = $parsedTemplate->getVariableContainer()->get('sections');
                if(!array_key_exists($sectionName, $sections)) {
-                       throw new RuntimeException('The given section does not exist!', 1227108982);
+                       throw new Tx_Fluid_View_Exception_InvalidSectionException('The given section does not exist!', 1227108982);
                }
                $section = $sections[$sectionName];
 
@@ -291,6 +301,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
         *
         * @param string $layoutName Name of the layout to use. If none given, use "default"
         * @return string Path and filename of layout file
+        * @throws Tx_Fluid_View_Exception_InvalidTemplateResourceException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        protected function resolveLayoutPathAndFilename($layoutName = 'default') {
@@ -305,7 +316,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
                                return $path;
                        }
                }
-               throw new RuntimeException('The template files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
+               throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('The template files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
        }
 
        /**
@@ -314,15 +325,19 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
         * @param string $partialName
         * @param string $sectionToRender
         * @param array $variables
+        * @param Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer $viewHelperVariableContainer the View Helper Variable container to use.
         * @return string
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         * @author Bastian Waidelich <bastian@typo3.org>
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function renderPartial($partialName, $sectionToRender, array $variables) {
+       public function renderPartial($partialName, $sectionToRender, array $variables, $viewHelperVariableContainer = NULL) {
                $partial = $this->parseTemplate($this->resolvePartialPathAndFilename($partialName));
                $variableContainer = $this->objectManager->create('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer', $variables);
                $renderingContext = $this->buildRenderingContext($variableContainer);
+               if ($viewHelperVariableContainer !== NULL) {
+                       $renderingContext->setViewHelperVariableContainer($viewHelperVariableContainer);
+               }
                return $partial->render($renderingContext);
        }
 
@@ -331,6 +346,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
         *
         * @param string $partialName The name of the partial
         * @return string the full path which should be used. The path definitely exists.
+        * @throws Tx_Fluid_View_Exception_InvalidTemplateResourceException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        protected function resolvePartialPathAndFilename($partialName) {
@@ -341,7 +357,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
                                return $path;
                        }
                }
-               throw new RuntimeException('The template files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
+               throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('The template files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
        }
 
        /**
@@ -356,7 +372,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
                try {
                        $this->resolveTemplatePathAndFilename();
                        return TRUE;
-               } catch (RuntimeException $e) {
+               } catch (Tx_Fluid_View_Exception_InvalidTemplateResourceException $e) {
                        return FALSE;
                }
        }
@@ -500,12 +516,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Extbase_MVC_View_AbstractView implem
 
                $results = array();
 
-               if ($controllerName !== NULL) {
-                       $i = -1;
-               } else {
-                       $i = 0;
-               }
-
+               $i = ($controllerName === NULL) ? 0 : -1;
                do {
                        $temporaryPattern = $pattern;
                        if ($i < 0) {
index e01144d..9b53b44 100644 (file)
@@ -112,7 +112,35 @@ class Tx_Fluid_ViewHelpers_Form_CheckboxViewHelper extends Tx_Fluid_ViewHelpers_
 
                $this->setErrorClassAttribute();
 
-               return $this->tag->render();
+               $hiddenField = $this->renderHiddenFieldForEmptyValue();
+               return $hiddenField . $this->tag->render();
+       }
+       
+       /**
+        * Renders a hidden field with the same name as the element, to make sure the empty value is submitted
+        * in case the checkbox is not selected.
+        * 
+        * @return string the hidden field.
+        */
+       protected function renderHiddenFieldForEmptyValue() {
+               if ($this->viewHelperVariableContainer->exists('Tx_Fluid_ViewHelpers_Form_CheckboxViewHelper', 'checkboxFieldNames')) {
+                       $checkboxFieldNames = $this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelpers_Form_CheckboxViewHelper', 'checkboxFieldNames');
+               } else {
+                       $checkboxFieldNames = array();
+               }
+
+               $nameOfElement = $this->getName();
+               if (!in_array($nameOfElement, $checkboxFieldNames)) {
+                       $checkboxFieldNames[] = $nameOfElement;
+                       $this->viewHelperVariableContainer->addOrUpdate('Tx_Fluid_ViewHelpers_Form_CheckboxViewHelper', 'checkboxFieldNames', $checkboxFieldNames);
+                       
+                       $tagBuilder = t3lib_div::makeInstance('Tx_Fluid_Core_ViewHelper_TagBuilder', 'input');
+                       $tagBuilder->addAttribute('type', 'hidden');
+                       $tagBuilder->addAttribute('name', $nameOfElement);
+                       $tagBuilder->addAttribute('value', '');
+                       return $tagBuilder->render();
+               }
+               return '';
        }
 }
 
index 24e1659..0cef520 100644 (file)
@@ -162,7 +162,7 @@ class Tx_Fluid_ViewHelpers_Form_SelectViewHelper extends Tx_Fluid_ViewHelpers_Fo
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
        protected function getOptions() {
-               if (!is_array($this->arguments['options']) && !($this->arguments['options'] instanceof Iterator)) {
+               if (!is_array($this->arguments['options']) && !($this->arguments['options'] instanceof Traversable)) {
                        return array();
                }
                $options = array();
index 789a72d..3e43e7f 100644 (file)
@@ -148,6 +148,7 @@ class Tx_Fluid_ViewHelpers_FormViewHelper extends Tx_Fluid_ViewHelpers_Form_Abst
                $this->removeFormObjectFromViewHelperVariableContainer();
                $this->removeFormNameFromViewHelperVariableContainer();
                $this->removeFormFieldNamesFromViewHelperVariableContainer();
+               $this->removeCheckboxFieldNamesFromViewHelperVariableContainer();
 
                return $this->tag->render();
        }
@@ -358,6 +359,15 @@ class Tx_Fluid_ViewHelpers_FormViewHelper extends Tx_Fluid_ViewHelpers_Form_Abst
 
                return 'tx_' . strtolower($extensionName) . '_' . strtolower($pluginName);
        }
+       
+       /**
+        * Remove Checkbox field names from ViewHelper variable container, to start from scratch when a new form starts.
+        */
+       protected function removeCheckboxFieldNamesFromViewHelperVariableContainer() {
+               if ($this->viewHelperVariableContainer->exists('Tx_Fluid_ViewHelpers_Form_CheckboxViewHelper', 'checkboxFieldNames')) {
+                       $this->viewHelperVariableContainer->remove('Tx_Fluid_ViewHelpers_Form_CheckboxViewHelper', 'checkboxFieldNames');
+               }
+       }
 }
 
 ?>
\ No newline at end of file
index e63e4d5..04d3643 100644 (file)
@@ -45,7 +45,6 @@
  * Output:
  * This is so...
  *
- * WARNING: This tag does NOT handle tags currently.
  * WARNING: This tag doesn't care about multibyte charsets currently.
  *
  * @package Fluid
@@ -81,6 +80,7 @@ class Tx_Fluid_ViewHelpers_Format_CropViewHelper extends Tx_Fluid_Core_ViewHelpe
         * @author Andreas Pattynama <andreas.pattynama@innocube.ch>
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         * @author Bastian Waidelich <bastian@typo3.org>
+        * @author Felix Oertel <oertel@networkteam.com>
         */
        public function render($maxCharacters, $append = '...', $respectWordBoundaries = TRUE) {
                $stringToTruncate = $this->renderChildren();
@@ -90,7 +90,11 @@ class Tx_Fluid_ViewHelpers_Format_CropViewHelper extends Tx_Fluid_Core_ViewHelpe
                        }
                        return $stringToTruncate;
                } else {
-                       return $this->contentObject->crop($stringToTruncate, $maxCharacters . '|' . $append . '|' . $respectWordBoundaries);
+                       if (strip_tags($stringToTruncate) != $stringToTruncate) {
+                               return $this->contentObject->cropHTML($stringToTruncate, $maxCharacters . '|' . $append . '|' . $respectWordBoundaries);
+                       } else {
+                               return $this->contentObject->crop($stringToTruncate, $maxCharacters . '|' . $append . '|' . $respectWordBoundaries);
+                       }
                }
        }
 }
index a32eb6c..4c148a1 100644 (file)
@@ -43,7 +43,7 @@ class Tx_Fluid_ViewHelpers_RenderViewHelper extends Tx_Fluid_Core_ViewHelper_Abs
         */
        public function render($section = '', $partial = '', $arguments = array()) {
                if ($partial !== '') {
-                       return $this->viewHelperVariableContainer->getView()->renderPartial($partial, $section, $arguments);
+                       return $this->viewHelperVariableContainer->getView()->renderPartial($partial, $section, $arguments, $this->viewHelperVariableContainer);
                } elseif ($section !== '') {
                        return $this->viewHelperVariableContainer->getView()->renderSection($section);
                }
index e0d96ae..af1c181 100644 (file)
@@ -23,7 +23,7 @@
 /**
  * Testcase for ViewHelperNode's evaluateBooleanExpression()
  *
- * @version $Id: ViewHelperNodeComparatorTest.php 3845 2010-02-23 22:04:14Z k-fish $
+ * @version $Id: ViewHelperNodeComparatorTest.php 4483 2010-06-10 13:57:32Z k-fish $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
 class Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNodeComparatorTest extends Tx_Extbase_BaseTestCase {
@@ -44,7 +44,7 @@ class Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNodeComparatorTest extends Tx_Ex
 
        /**
         * @test
-        * @expectedException \RuntimeException
+        * @expectedException Tx_Fluid_Core_Parser_Exception
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
        public function havingMoreThanThreeElementsInTheSyntaxTreeThrowsException() {
index 52b14e3..eeac250 100644 (file)
@@ -26,7 +26,7 @@ require_once(dirname(__FILE__) . '/../../Fixtures/TestViewHelper.php');
 /**
  * Testcase for [insert classname here]
  *
- * @version $Id: ViewHelperNodeTest.php 3835 2010-02-22 15:15:17Z robert $
+ * @version $Id: ViewHelperNodeTest.php 4005 2010-03-23 14:28:15Z k-fish $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
 class Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNodeTest extends Tx_Extbase_BaseTestCase {
index 7245a4d..f753d1e 100644 (file)
@@ -23,7 +23,7 @@
 /**
  * Testcase for ParsingState
  *
- * @version $Id: RenderingContextTest.php 3751 2010-01-22 15:56:47Z k-fish $
+ * @version $Id: RenderingContextTest.php 4005 2010-03-23 14:28:15Z k-fish $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
 class Tx_Fluid_Core_Rendering_RenderingContextTest extends Tx_Extbase_BaseTestCase {
index 43d81dc..be92b47 100644 (file)
@@ -25,7 +25,7 @@ require_once(dirname(__FILE__) . '/../Fixtures/TestViewHelper.php');
 /**
  * Testcase for AbstractViewHelper
  *
- * @version $Id: AbstractViewHelperTest.php 3835 2010-02-22 15:15:17Z robert $
+ * @version $Id: AbstractViewHelperTest.php 4483 2010-06-10 13:57:32Z k-fish $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
 class Tx_Fluid_Core_ViewHelper_AbstractViewHelperTest extends Tx_Extbase_BaseTestCase {
@@ -190,7 +190,7 @@ class Tx_Fluid_Core_ViewHelper_AbstractViewHelperTest extends Tx_Extbase_BaseTes
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @expectedException \RuntimeException
+        * @expectedException \InvalidArgumentException
         */
        public function validateArgumentsCallsTheRightValidatorsAndThrowsExceptionIfValidationIsWrong() {
                $mockReflectionService = $this->getMock('Tx_Extbase_Reflection_Service', array(), array(), '', FALSE);
index 5056893..a07f183 100644 (file)
@@ -23,7 +23,7 @@
 /**
  * Testcase for TemplateVariableContainer
  *
- * @version $Id: TemplateVariableContainerTest.php 3751 2010-01-22 15:56:47Z k-fish $
+ * @version $Id: TemplateVariableContainerTest.php 4494 2010-06-11 13:05:24Z robert $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
 class Tx_Fluid_Core_ViewHelper_TemplateVariableContainerTest extends Tx_Extbase_BaseTestCase {
@@ -40,6 +40,7 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainerTest extends Tx_Extbase_
        public function tearDown() {
                unset($this->variableContainer);
        }
+
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
@@ -49,58 +50,61 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainerTest extends Tx_Extbase_
                $this->variableContainer->add("variable", $object);
                $this->assertSame($this->variableContainer->get('variable'), $object, 'The retrieved object from the context is not the same as the stored object.');
        }
-       
+
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
-       public function addedObjectsExistInArray() {
+       public function addedObjectsCanBeRetrievedAgainUsingArrayAccess() {
                $object = "StringObject";
-               $this->variableContainer->add("variable", $object);
-               $this->assertSame($this->variableContainer->exists('variable'), TRUE, 'The object is reported to not be in the VariableContainer, but it is.');
+               $this->variableContainer['variable'] = $object;
+               $this->assertSame($this->variableContainer->get('variable'), $object);
+               $this->assertSame($this->variableContainer['variable'], $object);
        }
        
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
-       public function addedObjectsExistInAllIdentifiers() {
+       public function addedObjectsExistInArray() {
                $object = "StringObject";
                $this->variableContainer->add("variable", $object);
-               $this->assertEquals($this->variableContainer->getAllIdentifiers(), array('variable'), 'Added key is not visible in getAllIdentifiers');
+               $this->assertTrue($this->variableContainer->exists('variable'));
+               $this->assertTrue(isset($this->variableContainer['variable']));
        }
        
        /**
         * @test
-        * @expectedException \RuntimeException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
-       public function contextTakesOnlyArraysInConstructor() {
-               new Tx_Fluid_Core_ViewHelper_TemplateVariableContainer("string");
+       public function addedObjectsExistInAllIdentifiers() {
+               $object = "StringObject";
+               $this->variableContainer->add("variable", $object);
+               $this->assertEquals($this->variableContainer->getAllIdentifiers(), array('variable'), 'Added key is not visible in getAllIdentifiers');
        }
        
        /**
         * @test
-        * @expectedException \RuntimeException
+        * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        public function duplicateIdentifiersThrowException() {
                $this->variableContainer->add('variable', 'string1');
-               $this->variableContainer->add('variable', 'string2');
+               $this->variableContainer['variable'] = 'string2';
        }
 
        /**
         * @test
-        * @expectedException \RuntimeException
+        * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
         * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function addingReservedIdentifiersThrowException() {
-               $this->variableContainer->add('True', 'someValue');
+               $this->variableContainer->add('TrUe', 'someValue');
        }
 
        /**
         * @test
-        * @expectedException \RuntimeException
+        * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        public function gettingNonexistentValueThrowsException() {
@@ -109,7 +113,7 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainerTest extends Tx_Extbase_
        
        /**
         * @test
-        * @expectedException \RuntimeException
+        * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
        public function deletingNonexistentValueThrowsException() {
@@ -118,14 +122,13 @@ class Tx_Fluid_Core_ViewHelper_TemplateVariableContainerTest extends Tx_Extbase_
        
        /**
         * @test
+        * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         */
-       public function deleteReallyDeletesObjects() {
+       public function removeReallyRemovesVariables() {
                $this->variableContainer->add('variable', 'string1');
                $this->variableContainer->remove('variable');
-               try {
-                       $this->variableContainer->get('variable');
-               } catch (RuntimeException $e) {}
+               $this->variableContainer->get('variable');
        }
 }
 
index a381106..4b61a4d 100644 (file)
@@ -25,7 +25,7 @@ require_once(dirname(__FILE__) . '/../Fixtures/TestViewHelper.php');
 /**
  * Testcase for AbstractViewHelper
  *
- * @version $Id: ViewHelperVariableContainerTest.php 3350 2009-10-27 12:01:08Z k-fish $
+ * @version $Id: ViewHelperVariableContainerTest.php 4483 2010-06-10 13:57:32Z k-fish $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
 class Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainerTest extends Tx_Extbase_BaseTestCase {
@@ -55,7 +55,7 @@ class Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainerTest extends Tx_Extbas
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @expectedException \RuntimeException
+        * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
         */
        public function gettingNonNonExistentValueThrowsException() {
                $this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey');
@@ -64,7 +64,7 @@ class Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainerTest extends Tx_Extbas
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @expectedException \RuntimeException
+        * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
         */
        public function settingKeyWhichIsAlreadyStoredThrowsException() {
                $this->viewHelperVariableContainer->add('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey', 'value1');
@@ -94,7 +94,7 @@ class Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainerTest extends Tx_Extbas
        /**
         * @test
         * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @expectedException \RuntimeException
+        * @expectedException Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
         */
        public function removingNonExistentKeyThrowsException() {
                $this->viewHelperVariableContainer->remove('Tx_Fluid_ViewHelper_NonExistent', 'nonExistentKey');
index e68a6d2..54e009d 100644 (file)
@@ -26,7 +26,7 @@ include_once(dirname(__FILE__) . '/Fixtures/TemplateViewFixture.php');
 /**
  * Testcase for the TemplateView
  *
- * @version $Id: TemplateViewTest.php 3835 2010-02-22 15:15:17Z robert $
+ * @version $Id: TemplateViewTest.php 4334 2010-05-28 10:06:01Z robert $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
 class Tx_Fluid_View_TemplateViewTest extends Tx_Extbase_BaseTestCase {
@@ -124,7 +124,7 @@ class Tx_Fluid_View_TemplateViewTest extends Tx_Extbase_BaseTestCase {
         * @author Robert Lemke <robert@typo3.org>
         */
        protected function setupMockControllerContextForPathResolving($packageKey, $subPackageKey, $controllerName, $format) {
-               $controllerObjectName = "F3\\$packageKey\\" . ($subPackageKey != $subPackageKey . '\\' ? : '') . 'Controller\\' . $controllerName . 'Controller';
+       $controllerObjectName = 'Tx_' . $packageKey . '_' . ($subPackageKey !== '' ? '_' . $subPackageKey . '_' : '') . 'Controller_' . $controllerName . 'Controller';
 
                $mockRequest = $this->getMock('Tx_Extbase_MVC_Request');
                $mockRequest->expects($this->any())->method('getControllerPackageKey')->will($this->returnValue($packageKey));
@@ -244,10 +244,10 @@ class Tx_Fluid_View_TemplateViewTest extends Tx_Extbase_BaseTestCase {
                $mockPackageManager = $this->getMock('Tx_Fluid_Package_PackageManagerInterface', array('getPackage'));
                $mockPackageManager->expects($this->any())->method('getPackage')->with('DummyPackageKey')->will($this->returnValue($mockPackage));
 
-               \vfsStreamWrapper::register();
+               vfsStreamWrapper::register();
                $mockRootDirectory = vfsStreamDirectory::create('ExamplePackagePath/Resources/Private/Partials');
                $mockRootDirectory->getChild('Resources/Private/Partials')->addChild('Partials');
-               \vfsStreamWrapper::setRoot($mockRootDirectory);
+               vfsStreamWrapper::setRoot($mockRootDirectory);
 
                $this->getAccessibleMock('Tx_Fluid_Core_Parser_TemplateParser', array(''), array(), '', FALSE);
        }
@@ -311,6 +311,43 @@ class Tx_Fluid_View_TemplateViewTest extends Tx_Extbase_BaseTestCase {
                $templateView->setLayoutPathAndFilename(dirname(__FILE__) . '/Fixtures/LayoutFixture.html');
                $this->assertEquals($templateView->renderWithLayout('LayoutFixture'), '<div>Output</div>', 'Specific section was not rendered correctly!');
        }
+
+       /**
+        * @test
+        * @author Robert Lemke <robert@typo3.org>
+        */
+       public function resolveTemplatePathAndFilenameChecksDifferentPathPatternsAndReturnsTheFirstPathWhichExists() {
+               $this->markTestSkipped('vfs not yet supported in v4');
+               vfsStreamWrapper::register();
+               mkdir('vfs://MyTemplates');
+               file_put_contents('vfs://MyTemplates/MyCoolAction.html', '');
+
+               $paths = array(
+                        'vfs://NonExistantDir/UnknowFile.html',
+                        'vfs://MyTemplates/@action.html'
+               );
+
+               $templateView = $this->getAccessibleMock('Tx_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('vfs://MyTemplates/MyCoolAction.html', $templateView->_call('resolveTemplatePathAndFilename', 'myCoolAction'));
+               
+       }
+
+       /**
+        * @test
+        * @author Robert Lemke <robert@typo3.org>
+        */
+       public function resolveTemplatePathAndFilenameReturnsTheExplicitlyConfiguredTemplatePathAndFilename() {
+               $templateView = $this->getAccessibleMock('Tx_Fluid_View_TemplateView', array('dummy'), array(), '', FALSE);
+               $templateView->_set('templatePathAndFilename', 'Foo/Bar/Baz.html');
+
+               $this->assertSame('Foo/Bar/Baz.html', $templateView->_call('resolveTemplatePathAndFilename'));
+       }
 }
 
 ?>
\ No newline at end of file
index ac87104..cf4665a 100644 (file)
@@ -56,12 +56,5 @@ class Tx_Fluid_ViewHelpers_Form_ErrorsViewHelperTest extends Tx_Fluid_ViewHelper
                $this->assertEquals($expectedCallProtocol, $viewHelperNode->callProtocol, 'The call protocol differs');
        }
 
-       /**
-        * @test
-        * @author Christopher Hlubek <hlubek@networkteam.com>
-        */
-       public function renderWithForSpecifiedTriesToGetSpecificPropertyError() {
-               $this->markTestIncomplete('Not yet implemented');
-       }
 }
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Persistence/IdentityViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Persistence/IdentityViewHelperTest.php
new file mode 100644 (file)
index 0000000..cb393ec
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+
+/*                                                                        *
+ * This script belongs to the FLOW3 package "Fluid".                      *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+require_once(dirname(__FILE__) . '/../ViewHelperBaseTestcase.php');
+
+/**
+ * Testcase for IdentityViewHelper
+ *
+ * @version $Id$
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class Tx_Fluid_ViewHelpers_Persistence_IdentityViewHelperTest extends Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase {
+
+       /**
+        * @test
+        * @author Christopher Hlubek <hlubek@networkteam.com>
+        */
+       public function renderGetsIdentityForObjectFromPersistenceManager() {
+               $mockPersistenceManager = $this->getMock('Tx_Extbase_Persistence_ManagerInterface');
+
+               $viewHelper = $this->getAccessibleMock('Tx_Fluid_ViewHelpers_Persistence_IdentityViewHelper', array('dummy'), array(), '', FALSE);
+               $this->injectDependenciesIntoViewHelper($viewHelper);
+               $viewHelper->injectPersistenceManager($mockPersistenceManager);
+
+               $object = new stdClass();
+
+               $mockPersistenceManager->expects($this->atLeastOnce())->method('getIdentifierByObject')->with($object)->will($this->returnValue('6f487e40-4483-11de-8a39-0800200c9a66'));
+
+               $output = $viewHelper->render($object);
+
+               $this->assertEquals('6f487e40-4483-11de-8a39-0800200c9a66', $output, 'Identity is rendered as is');
+       }
+
+       /**
+        * @test
+        * @author Christopher Hlubek <hlubek@networkteam.com>
+        */
+       public function renderOutputsEmptyStringForNullIdentity() {
+               $mockPersistenceManager = $this->getMock('Tx_Extbase_Persistence_ManagerInterface');
+
+               $viewHelper = $this->getAccessibleMock('Tx_Fluid_ViewHelpers_Persistence_IdentityViewHelper', array('dummy'), array(), '', FALSE);
+               $this->injectDependenciesIntoViewHelper($viewHelper);
+               $viewHelper->injectPersistenceManager($mockPersistenceManager);
+
+               $object = new stdClass();
+
+               $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue(NULL));
+
+               $output = $viewHelper->render($object);
+
+               $this->assertEquals('', $output, 'NULL Identity is rendered as empty string');
+       }
+}
+
+?>
\ No newline at end of file
index 6fc5453..1e8e9e0 100644 (file)
@@ -29,6 +29,7 @@ return array(
        'tx_fluid_core_viewhelper_argumentdefinition' => $extensionPath . 'Classes/Core/ViewHelper/ArgumentDefinition.php',
        'tx_fluid_core_viewhelper_arguments' => $extensionPath . 'Classes/Core/ViewHelper/Arguments.php',
        'tx_fluid_core_viewhelper_exception' => $extensionPath . 'Classes/Core/ViewHelper/Exception.php',
+       'tx_fluid_core_viewhelper_exception_invalidvariableexception' => $extensionPath . 'Classes/Core/ViewHelper/Exception/InvalidVariableException.php',
        'tx_fluid_core_viewhelper_tagbasedviewhelper' => $extensionPath . 'Classes/Core/ViewHelper/TagBasedViewHelper.php',
        'tx_fluid_core_viewhelper_tagbuilder' => $extensionPath . 'Classes/Core/ViewHelper/TagBuilder.php',
        'tx_fluid_core_viewhelper_templatevariablecontainer' => $extensionPath . 'Classes/Core/ViewHelper/TemplateVariableContainer.php',
@@ -41,6 +42,7 @@ return array(
        'tx_fluid_view_templateview' => $extensionPath . 'Classes/View/TemplateView.php',
        'tx_fluid_view_templateviewinterface' => $extensionPath . 'Classes/View/TemplateViewInterface.php',
        'tx_fluid_view_exception_invalidtemplateresourceexception' => $extensionPath . 'Classes/View/Exception/InvalidTemplateResourceException.php',
+       'tx_fluid_view_exception_invalidsectionexception' => $extensionPath . 'Classes/View/Exception/InvalidSectionException.php',
        'tx_fluid_viewhelpers_aliasviewhelper' => $extensionPath . 'Classes/ViewHelpers/AliasViewHelper.php',
        'tx_fluid_viewhelpers_baseviewhelper' => $extensionPath . 'Classes/ViewHelpers/BaseViewHelper.php',
        'tx_fluid_viewhelpers_cobjectviewhelper' => $extensionPath . 'Classes/ViewHelpers/CObjectViewHelper.php',
index 2849dc4..b3ca590 100755 (executable)
@@ -29,7 +29,7 @@ $EM_CONF[$_EXTKEY] = array(
        'clearCacheOnLoad' => 0,
        'lockType' => '',
        'author_company' => '',
-       'version' => '1.2.0beta1',
+       'version' => '1.2.0RC1',
        'constraints' => array(
                'depends' => array(
                        'extbase' => '',