From a26e2da0ce5583e026b06a756db37a60a5c7a774 Mon Sep 17 00:00:00 2001 From: Jochen Rau Date: Thu, 8 Oct 2009 13:15:09 +0000 Subject: [PATCH] [~CONFIGURATION] Extbase: Set lockType to empty string instead of 'system'. [+BUGFIX] Extbase (Tests): Fixed and renamed BaseTestCase. It supports now Data Providers. [+TASK] Extbase (Tests): Added Data Provider for Typo3DbBackend. [+BUGFIX] Extbase (Persistence): Added LazyObjectStorage to the list of types in property meta-data. [+BUGFIX] Extbase (Persistence): Fixed a problem with value object database tables without deleted and/or hidden column. [~BUGFIX] Extbase (Persistence): Added the same ugly hack (setRespectStoragePage(FALSE)) to mm-relations. [+BUGFIX] Extbase (Persistence): The Lazy Object Storage really counts stored items (foreign key, relation table) without loading them. --- .../Classes/Persistence/LazyObjectStorage.php | 23 ++-- .../Classes/Persistence/Mapper/DataMapper.php | 5 +- .../Persistence/Storage/Typo3DbBackend.php | 26 ++-- .../extbase/Classes/Property/Mapper.php | 4 +- typo3/sysext/extbase/Tests/BaseTestCase.php | 113 ++++++++++++++++++ .../AbstractConfigurationManager_testcase.php | 2 +- .../BackendConfigurationManager_testcase.php | 2 +- .../FrontendConfigurationManager_testcase.php | 2 +- .../Source/FlexFormSource_testcase.php | 2 +- .../Source/TypoScriptSource_testcase.php | 2 +- .../DomainObject/AbstractEntity_testcase.php | 2 +- .../AbstractController_testcase.php | 2 +- .../Controller/ActionController_testcase.php | 2 +- .../MVC/Controller/Argument_testcase.php | 2 +- .../MVC/Controller/Arguments_testcase.php | 2 +- .../Tests/MVC/Web/RequestBuilder_testcase.php | 2 +- .../MVC/Web/Routing/UriBuilder_testcase.php | 2 +- .../Persistence/Mapper/DataMap_testcase.php | 2 +- .../Persistence/ObjectStorage_testcase.php | 2 +- .../Tests/Persistence/Query_testcase.php | 2 +- .../Tests/Persistence/Repository_testcase.php | 2 +- .../Storage/Typo3DbBackend_testcase.php | 34 +++++- .../Tests/Reflection/Service_testcase.php | 2 +- .../AlphanumericValidator_testcase.php | 2 +- .../ConjunctionValidator_testcase.php | 2 +- .../Validator/DateTimeValidator_testcase.php | 2 +- .../EmailAddressValidator_testcase.php | 2 +- .../Validator/FloatValidator_testcase.php | 2 +- .../GenericObjectValidator_testcase.php | 2 +- .../Validator/IntegerValidator_testcase.php | 2 +- .../Validator/NotEmptyValidator_testcase.php | 2 +- .../NumberRangeValidator_testcase.php | 2 +- .../Validator/NumberValidator_testcase.php | 2 +- .../Validator/RawValidator_testcase.php | 2 +- .../RegularExpressionValidator_testcase.php | 2 +- .../StringLengthValidator_testcase.php | 2 +- .../Validator/TextValidator_testcase.php | 2 +- .../Validation/ValidatorResolver_testcase.php | 2 +- typo3/sysext/extbase/ext_emconf.php | 2 +- typo3/sysext/extbase/ext_tables.php | 5 + 40 files changed, 217 insertions(+), 59 deletions(-) create mode 100644 typo3/sysext/extbase/Tests/BaseTestCase.php diff --git a/typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php b/typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php index 705aa85b09d8..5bf53d85b965 100644 --- a/typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php +++ b/typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php @@ -113,17 +113,18 @@ class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_Ob public function count() { $numberOfElements = NULL; if ($this->columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) { - $this->initializeStorage(); - $numberOfElements = count($this->storage); - // FIXME Count on comma separated lists does not respect hidden objects -// if (isset($parentKeyFieldName)) { -// $numberOfElements = $this->fieldValue; -// } else { -// if (empty($this->fieldValue)) { -// $numberOfElements = 0; -// } -// $numberOfElements = count(explode(',', $this->fieldValue)); -// } + $parentKeyFieldName = $this->columnMap->getParentKeyFieldName(); + if (!empty($parentKeyFieldName)) { + $numberOfElements = $this->fieldValue; + } else { + $this->initializeStorage(); + $numberOfElements = count($this->storage); + // FIXME Count on comma separated lists does not respect hidden objects + // if (empty($this->fieldValue)) { + // $numberOfElements = 0; + // } + // $numberOfElements = count(explode(',', $this->fieldValue)); + } } elseif ($this->columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) { $numberOfElements = $this->fieldValue; } else { diff --git a/typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php b/typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php index a310081a7e0d..4c4235e9cdf7 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php +++ b/typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php @@ -166,7 +166,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton { $columnMap = $dataMap->getColumnMap($propertyName); $columnName = $columnMap->getColumnName(); $propertyValue = NULL; - $propertyType = $columnMap->getPropertyType(); + $propertyType = $columnMap->getPropertyType(); switch ($propertyType) { case Tx_Extbase_Persistence_PropertyType::STRING; case Tx_Extbase_Persistence_PropertyType::DATE; @@ -285,6 +285,9 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton { $query = $queryFactory->create($columnMap->getChildClassName()); $query->setSource($source); $query->setOrderings(array($columnMap->getChildSortByFieldName() => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING)); + // TODO: This is an ugly hack, just ignoring the storage page state from here. Actually, the query settings would have to be passed into the DataMapper, so we can respect + // enableFields and storage page settings. + $query->getQuerySettings()->setRespectStoragePage(FALSE); $objects = $query->matching($query->equals($columnMap->getParentKeyFieldName(), $parentObject->getUid()))->execute(); } else { throw new Tx_Extbase_Persistence_Exception('Could not determine type of relation.', 1252502725); diff --git a/typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php b/typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php index 51de9044f8a3..6c941f22f070 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php @@ -230,7 +230,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis } $this->replacePlaceholders($statement, $parameters); - + // debug($statement,-2); return $statement; } @@ -239,23 +239,31 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis * * @param array $properties The properties of the Value Object * @param Tx_Extbase_Persistence_Mapper_DataMap $dataMap The Data Map - * @return array The matching tuples + * @return array The matching uid */ public function hasValueObject(array $properties, Tx_Extbase_Persistence_Mapper_DataMap $dataMap) { $fields = array(); $parameters = array(); foreach ($properties as $propertyName => $propertyValue) { - if ($dataMap->isPersistableProperty($propertyName) && ($propertyName !== 'uid')) { + // FIXME We couple the Backend to the Entity implementation (uid, isClone); changes there breaks this method + if ($dataMap->isPersistableProperty($propertyName) && ($propertyName !== 'uid') && ($propertyName !== 'pid') && ($propertyName !== 'isClone')) { $fields[] = $dataMap->getColumnMap($propertyName)->getColumnName() . '=?'; $parameters[] = $dataMap->convertPropertyValueToFieldValue($propertyValue); } } - $fields[] = 'deleted != 1'; - $fields[] = 'hidden != 1'; - - $sqlString = 'SELECT * FROM ' . $dataMap->getTableName() . ' WHERE ' . implode(' AND ', $fields); - $this->replacePlaceholders($sqlString, $parameters); - $res = $this->databaseHandle->sql_query($sqlString); + $sql = array(); + $sql['additionalWhereClause'] = array(); + + $tableName = $dataMap->getTableName(); + $this->addEnableFieldsStatement($tableName, $sql); + + $statement = 'SELECT * FROM ' . $tableName; + $statement .= ' WHERE ' . implode(' AND ', $fields); + if (!empty($sql['additionalWhereClause'])) { + $statement .= ' AND ' . implode(' AND ', $sql['additionalWhereClause']); + } + $this->replacePlaceholders($statement, $parameters); + $res = $this->databaseHandle->sql_query($statement); $this->checkSqlErrors(); $row = $this->databaseHandle->sql_fetch_assoc($res); if ($row !== FALSE) { diff --git a/typo3/sysext/extbase/Classes/Property/Mapper.php b/typo3/sysext/extbase/Classes/Property/Mapper.php index db164d7fee40..322e3aa53a6f 100644 --- a/typo3/sysext/extbase/Classes/Property/Mapper.php +++ b/typo3/sysext/extbase/Classes/Property/Mapper.php @@ -196,7 +196,7 @@ 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', 'Tx_Extbase_Persistence_LazyObjectStorage')) && strpos($propertyMetaData['elementType'], '_') !== FALSE) { $objects = array(); foreach ($propertyValue as $value) { $objects[] = $this->transformToObject($value, $propertyMetaData['elementType'], $propertyName); @@ -205,7 +205,7 @@ class Tx_Extbase_Property_Mapper { // make sure we hand out what is expected if ($propertyMetaData['type'] === 'ArrayObject') { $propertyValue = new ArrayObject($objects); - } elseif ($propertyMetaData['type']=== 'Tx_Extbase_Persistence_ObjectStorage') { + } elseif ($propertyMetaData['type'] === 'Tx_Extbase_Persistence_ObjectStorage' || $propertyMetaData['type'] === 'Tx_Extbase_Persistence_LazyObjectStorage') { $propertyValue = new Tx_Extbase_Persistence_ObjectStorage(); foreach ($objects as $object) { $propertyValue->attach($object); diff --git a/typo3/sysext/extbase/Tests/BaseTestCase.php b/typo3/sysext/extbase/Tests/BaseTestCase.php new file mode 100644 index 000000000000..0ea392ac4660 --- /dev/null +++ b/typo3/sysext/extbase/Tests/BaseTestCase.php @@ -0,0 +1,113 @@ + +* 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! +***************************************************************/ + +require_once(t3lib_extMgm::extPath('phpunit') . 'class.tx_phpunit_testcase.php'); + +/** + * Base testcase for the Extbase extension. + */ +abstract class Tx_Extbase_BaseTestCase extends tx_phpunit_testcase { + + /** + * @var Tx_Extbase_Object_ManagerInterface The object manager + */ + protected $objectManager; + + /** + * Constructs a test case with the given name. + * + * @param string $name + * @param array $data + * @param string $dataName + */ + public function __construct($name = NULL, array $data = array(), $dataName = '') { + parent::__construct($name, $data, $dataName); + if (!class_exists('Tx_Extbase_Utility_ClassLoader')) { + require(t3lib_extmgm::extPath('extbase') . 'Classes/Utility/ClassLoader.php'); + } + spl_autoload_register(array('Tx_Extbase_Utility_ClassLoader', 'loadClass')); + } + + /** + * Injects an untainted clone of the object manager and all its referencing + * objects for every test. + * + * @return void + */ + public function runBare() { + $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_Manager'); + $this->objectManager = clone $objectManager; + parent::runBare(); + } + + /** + * Creates a proxy class of the specified class which allows + * for calling even protected methods and access of protected properties. + * + * @param protected $className Full qualified name of the original class + * @return string Full qualified name of the built class + */ + protected function buildAccessibleProxy($className) { + $accessibleClassName = uniqid('AccessibleTestProxy'); + $class = new ReflectionClass($className); + $abstractModifier = $class->isAbstract() ? 'abstract ' : ''; + eval(' + ' . $abstractModifier . 'class ' . $accessibleClassName . ' extends ' . $className . ' { + public function _call($methodName) { + $args = func_get_args(); + return call_user_func_array(array($this, $methodName), array_slice($args, 1)); + } + public function _callRef($methodName, &$arg1 = NULL, &$arg2 = NULL, &$arg3 = NULL, &$arg4 = NULL, &$arg5= NULL, &$arg6 = NULL, &$arg7 = NULL, &$arg8 = NULL, &$arg9 = NULL) { + switch (func_num_args()) { + case 0 : return $this->$methodName(); + case 1 : return $this->$methodName($arg1); + case 2 : return $this->$methodName($arg1, $arg2); + case 3 : return $this->$methodName($arg1, $arg2, $arg3); + case 4 : return $this->$methodName($arg1, $arg2, $arg3, $arg4); + case 5 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5); + case 6 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6); + case 7 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); + case 8 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8); + case 9 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8, $arg9); + } + } + public function _set($propertyName, $value) { + $this->$propertyName = $value; + } + public function _setRef($propertyName, &$value) { + $this->$propertyName = $value; + } + public function _get($propertyName) { + return $this->$propertyName; + } + } + '); + return $accessibleClassName; + } + +} +?> \ No newline at end of file diff --git a/typo3/sysext/extbase/Tests/Configuration/AbstractConfigurationManager_testcase.php b/typo3/sysext/extbase/Tests/Configuration/AbstractConfigurationManager_testcase.php index 3561d731685a..847f2f5f61d7 100644 --- a/typo3/sysext/extbase/Tests/Configuration/AbstractConfigurationManager_testcase.php +++ b/typo3/sysext/extbase/Tests/Configuration/AbstractConfigurationManager_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Configuration_AbstractConfigurationManager_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Configuration_AbstractConfigurationManager_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Configuration/BackendConfigurationManager_testcase.php b/typo3/sysext/extbase/Tests/Configuration/BackendConfigurationManager_testcase.php index 209a1d082152..58dae6354c82 100644 --- a/typo3/sysext/extbase/Tests/Configuration/BackendConfigurationManager_testcase.php +++ b/typo3/sysext/extbase/Tests/Configuration/BackendConfigurationManager_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Configuration_BackendConfigurationManager_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Configuration_BackendConfigurationManager_testcase extends Tx_Extbase_BaseTestCase { /** * @var array diff --git a/typo3/sysext/extbase/Tests/Configuration/FrontendConfigurationManager_testcase.php b/typo3/sysext/extbase/Tests/Configuration/FrontendConfigurationManager_testcase.php index 3ee7ff2a3042..a9dc82bcc9ed 100644 --- a/typo3/sysext/extbase/Tests/Configuration/FrontendConfigurationManager_testcase.php +++ b/typo3/sysext/extbase/Tests/Configuration/FrontendConfigurationManager_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Configuration_FrontendConfigurationManager_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Configuration_FrontendConfigurationManager_testcase extends Tx_Extbase_BaseTestCase { /** * @var tslib_fe diff --git a/typo3/sysext/extbase/Tests/Configuration/Source/FlexFormSource_testcase.php b/typo3/sysext/extbase/Tests/Configuration/Source/FlexFormSource_testcase.php index 8adacac22fc6..4ddac77d5ac5 100644 --- a/typo3/sysext/extbase/Tests/Configuration/Source/FlexFormSource_testcase.php +++ b/typo3/sysext/extbase/Tests/Configuration/Source/FlexFormSource_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Configuration_Source_FlexFormSource_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Configuration_Source_FlexFormSource_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Configuration/Source/TypoScriptSource_testcase.php b/typo3/sysext/extbase/Tests/Configuration/Source/TypoScriptSource_testcase.php index 5f35f15e76df..ff61879c7c19 100644 --- a/typo3/sysext/extbase/Tests/Configuration/Source/TypoScriptSource_testcase.php +++ b/typo3/sysext/extbase/Tests/Configuration/Source/TypoScriptSource_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Configuration_Source_TypoScriptSource_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Configuration_Source_TypoScriptSource_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/DomainObject/AbstractEntity_testcase.php b/typo3/sysext/extbase/Tests/DomainObject/AbstractEntity_testcase.php index d17c16041c96..b542f37181ed 100644 --- a/typo3/sysext/extbase/Tests/DomainObject/AbstractEntity_testcase.php +++ b/typo3/sysext/extbase/Tests/DomainObject/AbstractEntity_testcase.php @@ -22,7 +22,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_DomainObject_AbstractEntity_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_DomainObject_AbstractEntity_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/MVC/Controller/AbstractController_testcase.php b/typo3/sysext/extbase/Tests/MVC/Controller/AbstractController_testcase.php index 3671b358733f..d398cb785e67 100644 --- a/typo3/sysext/extbase/Tests/MVC/Controller/AbstractController_testcase.php +++ b/typo3/sysext/extbase/Tests/MVC/Controller/AbstractController_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_MVC_Controller_AbstractController_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_MVC_Controller_AbstractController_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/MVC/Controller/ActionController_testcase.php b/typo3/sysext/extbase/Tests/MVC/Controller/ActionController_testcase.php index 58da52e15982..ff2b9ec2eded 100644 --- a/typo3/sysext/extbase/Tests/MVC/Controller/ActionController_testcase.php +++ b/typo3/sysext/extbase/Tests/MVC/Controller/ActionController_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_MVC_Controller_ActionController_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_MVC_Controller_ActionController_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/MVC/Controller/Argument_testcase.php b/typo3/sysext/extbase/Tests/MVC/Controller/Argument_testcase.php index 2393ee25191e..af5e4e954d92 100644 --- a/typo3/sysext/extbase/Tests/MVC/Controller/Argument_testcase.php +++ b/typo3/sysext/extbase/Tests/MVC/Controller/Argument_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_MVC_Controller_Argument_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_MVC_Controller_Argument_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/MVC/Controller/Arguments_testcase.php b/typo3/sysext/extbase/Tests/MVC/Controller/Arguments_testcase.php index e940c9ca0186..8d8efbced3c2 100644 --- a/typo3/sysext/extbase/Tests/MVC/Controller/Arguments_testcase.php +++ b/typo3/sysext/extbase/Tests/MVC/Controller/Arguments_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_MVC_Controller_Arguments_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_MVC_Controller_Arguments_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/MVC/Web/RequestBuilder_testcase.php b/typo3/sysext/extbase/Tests/MVC/Web/RequestBuilder_testcase.php index 1d7228be3eaf..851fe5195e1c 100644 --- a/typo3/sysext/extbase/Tests/MVC/Web/RequestBuilder_testcase.php +++ b/typo3/sysext/extbase/Tests/MVC/Web/RequestBuilder_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_MVC_Web_RequestBuilder_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_MVC_Web_RequestBuilder_testcase extends Tx_Extbase_BaseTestCase { /** * @var array diff --git a/typo3/sysext/extbase/Tests/MVC/Web/Routing/UriBuilder_testcase.php b/typo3/sysext/extbase/Tests/MVC/Web/Routing/UriBuilder_testcase.php index 85ec3a9b78e7..a32142dbf951 100644 --- a/typo3/sysext/extbase/Tests/MVC/Web/Routing/UriBuilder_testcase.php +++ b/typo3/sysext/extbase/Tests/MVC/Web/Routing/UriBuilder_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_MVC_Web_Routing_UriBuilder_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_MVC_Web_Routing_UriBuilder_testcase extends Tx_Extbase_BaseTestCase { /** * @var tslib_fe diff --git a/typo3/sysext/extbase/Tests/Persistence/Mapper/DataMap_testcase.php b/typo3/sysext/extbase/Tests/Persistence/Mapper/DataMap_testcase.php index 36200c3bb513..ae2326aa9196 100644 --- a/typo3/sysext/extbase/Tests/Persistence/Mapper/DataMap_testcase.php +++ b/typo3/sysext/extbase/Tests/Persistence/Mapper/DataMap_testcase.php @@ -27,7 +27,7 @@ require_once(PATH_tslib . 'class.tslib_content.php'); -class Tx_Extbase_Persistence_Mapper_DataMap_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Persistence_Mapper_DataMap_testcase extends Tx_Extbase_BaseTestCase { public function setUp() { require_once(t3lib_extMgm::extPath('blog_example') . 'Classes/Domain/Model/Blog.php'); diff --git a/typo3/sysext/extbase/Tests/Persistence/ObjectStorage_testcase.php b/typo3/sysext/extbase/Tests/Persistence/ObjectStorage_testcase.php index 16dea3405d9e..ef25b31730c1 100644 --- a/typo3/sysext/extbase/Tests/Persistence/ObjectStorage_testcase.php +++ b/typo3/sysext/extbase/Tests/Persistence/ObjectStorage_testcase.php @@ -25,7 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Persistence_ObjectStorage_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Persistence_ObjectStorage_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Persistence/Query_testcase.php b/typo3/sysext/extbase/Tests/Persistence/Query_testcase.php index 4795e7b64875..82b56ba7d80d 100644 --- a/typo3/sysext/extbase/Tests/Persistence/Query_testcase.php +++ b/typo3/sysext/extbase/Tests/Persistence/Query_testcase.php @@ -22,7 +22,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Persistence_Query_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Persistence_Query_testcase extends Tx_Extbase_BaseTestCase { public function setUp() { } diff --git a/typo3/sysext/extbase/Tests/Persistence/Repository_testcase.php b/typo3/sysext/extbase/Tests/Persistence/Repository_testcase.php index c55f29bc5025..1bf7dd32b9e3 100644 --- a/typo3/sysext/extbase/Tests/Persistence/Repository_testcase.php +++ b/typo3/sysext/extbase/Tests/Persistence/Repository_testcase.php @@ -22,7 +22,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Persistence_Repository_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Persistence_Repository_testcase extends Tx_Extbase_BaseTestCase { /** diff --git a/typo3/sysext/extbase/Tests/Persistence/Storage/Typo3DbBackend_testcase.php b/typo3/sysext/extbase/Tests/Persistence/Storage/Typo3DbBackend_testcase.php index 1a5b9c633839..98f67c6d73fe 100644 --- a/typo3/sysext/extbase/Tests/Persistence/Storage/Typo3DbBackend_testcase.php +++ b/typo3/sysext/extbase/Tests/Persistence/Storage/Typo3DbBackend_testcase.php @@ -25,9 +25,37 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Tx_Extbase_Persistence_Storage_Typo3DbBackend_testcase extends Tx_Extbase_Base_testcase { - - public function setUp() { +class Tx_Extbase_Persistence_Storage_Typo3DbBackend_testcase extends Tx_Extbase_BaseTestCase { + + /** + * This is the data provider for the statement generation with a basic comparison + * + * @return array An array of data + */ + public function providerForBasicComparison() { + return array( + 'equal' => array( + Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_EQUAL_TO, + "SELECT table_name_from_selector.* FROM table_name_from_selector WHERE table_name_from_property.foo = 'baz'" + ), + 'less' => array( + Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_LESS_THAN, + "SELECT table_name_from_selector.* FROM table_name_from_selector WHERE table_name_from_property.foo < 'baz'" + ), + 'less or equal' => array( + Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, + "SELECT table_name_from_selector.* FROM table_name_from_selector WHERE table_name_from_property.foo <= 'baz'" + ), + 'greater' => array( + Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_GREATER_THAN, + "SELECT table_name_from_selector.* FROM table_name_from_selector WHERE table_name_from_property.foo > 'baz'" + ), + 'greater or equal' => array( + Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, + "SELECT table_name_from_selector.* FROM table_name_from_selector WHERE table_name_from_property.foo >= 'baz'" + ), + + ); } /** diff --git a/typo3/sysext/extbase/Tests/Reflection/Service_testcase.php b/typo3/sysext/extbase/Tests/Reflection/Service_testcase.php index 021f1e9bcebc..6f67c0c84ce1 100644 --- a/typo3/sysext/extbase/Tests/Reflection/Service_testcase.php +++ b/typo3/sysext/extbase/Tests/Reflection/Service_testcase.php @@ -25,7 +25,7 @@ /** * Some functional tests for the backport of the reflection service */ -class Tx_Extbase_Reflection_Service_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Reflection_Service_testcase extends Tx_Extbase_BaseTestCase { /** * @param array $foo The foo parameter diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/AlphanumericValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/AlphanumericValidator_testcase.php index 0c4cd34ef5f7..8f1074a69b54 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/AlphanumericValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/AlphanumericValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_AlphanumericValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_AlphanumericValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/ConjunctionValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/ConjunctionValidator_testcase.php index 54489504767a..cba9cadfe3e9 100644 --- a/typo3/sysext/extbase/Tests/Validation/Validator/ConjunctionValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/ConjunctionValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id: ConjunctionValidator_testcase.php -1 $ */ -class Tx_Extbase_Validation_Validator_ConjunctionValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_ConjunctionValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/DateTimeValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/DateTimeValidator_testcase.php index 5a5ca71ec217..bd29bc032795 100644 --- a/typo3/sysext/extbase/Tests/Validation/Validator/DateTimeValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/DateTimeValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_DateTimeValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_DateTimeValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/EmailAddressValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/EmailAddressValidator_testcase.php index 001c1090b7ec..679ceac6f629 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/EmailAddressValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/EmailAddressValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_EmailAddressValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_EmailAddressValidator_testcase extends Tx_Extbase_BaseTestCase { /** * An array of valid email addresses diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/FloatValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/FloatValidator_testcase.php index 897b62ad33fa..29fa5efe6dfa 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/FloatValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/FloatValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_FloatValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_FloatValidator_testcase extends Tx_Extbase_BaseTestCase { /** * An array of valid floating point numbers addresses diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/GenericObjectValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/GenericObjectValidator_testcase.php index 14fd1fb03301..3962270c0b3e 100644 --- a/typo3/sysext/extbase/Tests/Validation/Validator/GenericObjectValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/GenericObjectValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_GenericObjectValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_GenericObjectValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/IntegerValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/IntegerValidator_testcase.php index c8df967f251c..0b979e045bc2 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/IntegerValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/IntegerValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_IntegerValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_IntegerValidator_testcase extends Tx_Extbase_BaseTestCase { /** * An array of valid floating point numbers addresses diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/NotEmptyValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/NotEmptyValidator_testcase.php index d67a16609e0d..9345cf5ea974 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/NotEmptyValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/NotEmptyValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_NotEmptyValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_NotEmptyValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/NumberRangeValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/NumberRangeValidator_testcase.php index 02cc92833807..f6599552d18b 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/NumberRangeValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/NumberRangeValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_NumberRangeValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_NumberRangeValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/NumberValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/NumberValidator_testcase.php index 4108ef0cd8fa..bd23a1223d7f 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/NumberValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/NumberValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_NumberValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_NumberValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/RawValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/RawValidator_testcase.php index 53f70e7312c3..2c073bfca006 100644 --- a/typo3/sysext/extbase/Tests/Validation/Validator/RawValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/RawValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_RawValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_RawValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/RegularExpressionValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/RegularExpressionValidator_testcase.php index a673098134ed..c376bc771590 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/RegularExpressionValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/RegularExpressionValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_RegularExpressionValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_RegularExpressionValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/StringLengthValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/StringLengthValidator_testcase.php index e36b0797f29b..b29a92802bf0 100644 --- a/typo3/sysext/extbase/Tests/Validation/Validator/StringLengthValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/StringLengthValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_StringLengthValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_StringLengthValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/Validator/TextValidator_testcase.php b/typo3/sysext/extbase/Tests/Validation/Validator/TextValidator_testcase.php index ee254be0f0c5..5f0b0094ee62 100755 --- a/typo3/sysext/extbase/Tests/Validation/Validator/TextValidator_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/Validator/TextValidator_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_Validator_TextValidator_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_Validator_TextValidator_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/Tests/Validation/ValidatorResolver_testcase.php b/typo3/sysext/extbase/Tests/Validation/ValidatorResolver_testcase.php index 4d5559e02dbe..180c418d1a82 100644 --- a/typo3/sysext/extbase/Tests/Validation/ValidatorResolver_testcase.php +++ b/typo3/sysext/extbase/Tests/Validation/ValidatorResolver_testcase.php @@ -32,7 +32,7 @@ * @subpackage extbase * @version $Id$ */ -class Tx_Extbase_Validation_ValidatorResolver_testcase extends Tx_Extbase_Base_testcase { +class Tx_Extbase_Validation_ValidatorResolver_testcase extends Tx_Extbase_BaseTestCase { /** * @test diff --git a/typo3/sysext/extbase/ext_emconf.php b/typo3/sysext/extbase/ext_emconf.php index 4371d3fc88c3..4d7e7f18780a 100644 --- a/typo3/sysext/extbase/ext_emconf.php +++ b/typo3/sysext/extbase/ext_emconf.php @@ -27,7 +27,7 @@ $EM_CONF[$_EXTKEY] = array( 'createDirs' => '', 'modify_tables' => '', 'clearCacheOnLoad' => 0, - 'lockType' => 'system', + 'lockType' => '', 'author_company' => 'TYPO3 core team', 'version' => '0.9.9', 'constraints' => array( diff --git a/typo3/sysext/extbase/ext_tables.php b/typo3/sysext/extbase/ext_tables.php index 65817b9f9d42..392919087183 100644 --- a/typo3/sysext/extbase/ext_tables.php +++ b/typo3/sysext/extbase/ext_tables.php @@ -3,6 +3,11 @@ if (!defined ('TYPO3_MODE')) die ('Access denied.'); if (TYPO3_MODE == 'BE') { + + if (t3lib_extMgm::isLoaded('phpunit')) { + require_once(t3lib_extMgm::extPath('extbase') . 'Tests/BaseTestCase.php'); + } + // register the cache in BE so it will be cleared with "clear all caches" try { t3lib_cache::initializeCachingFramework(); -- 2.20.1