[TASK] Extbase: Added some comments
authorJochen Rau <j.rau@web.de>
Tue, 21 Jul 2009 22:06:46 +0000 (22:06 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 21 Jul 2009 22:06:46 +0000 (22:06 +0000)
[TASK] Extbase: Added unit test class for the TYPO3DbBackend (empty by now)

typo3/sysext/extbase/Classes/Configuration/Manager.php
typo3/sysext/extbase/Classes/Persistence/Backend.php
typo3/sysext/extbase/Classes/Persistence/Query.php
typo3/sysext/extbase/Tests/Persistence/Storage/Typo3DbBackend_testcase.php [new file with mode: 0644]

index d9e54ec..7ac1e13 100644 (file)
@@ -100,6 +100,7 @@ class Tx_Extbase_Configuration_Manager {
                $settings = array();
                $settings['storagePid'] = $this->getDefaultStoragePageId($cObj);
                $settings['contentObjectData'] = $cObj->data;
+               // TODO Support BE modules by parsing the file "manually" and all files EXT:myext/Configuration/Objects/setup.txt
                $extbaseConfiguration = $GLOBALS['TSFE']->tmpl->setup['config.']['tx_extbase.'];
                if (is_array($extbaseConfiguration)) {
                        $extbaseConfiguration = Tx_Extbase_Configuration_Manager::postProcessSettings($extbaseConfiguration);
@@ -124,6 +125,7 @@ class Tx_Extbase_Configuration_Manager {
        protected function getDefaultStoragePageId($cObj) {
                if (is_string($cObj->data['pages'])) {
                        if (count(explode(',', $cObj->data['pages'])) > 1) {
+                               // TODO Should we take the first pid after explode?
                                throw new InvalidArgumentException('More than one storage page ID given. This is currently not supported.', 1247597243);
                        }
                        return (int)$cObj->data['pages'];
@@ -136,6 +138,7 @@ class Tx_Extbase_Configuration_Manager {
                if ($cObj->parentRecord->data['storage_pid'] > 0) {
                        return (int)$cObj->parentRecord->data['storage_pid'];
                }
+               // FIXME Take $GLOBALS['TSFE']->getStorageSiterootPids(); as default for FE and 0 for BE
                return self::DEFAULT_STORAGE_PID;
        }
        
@@ -161,6 +164,7 @@ class Tx_Extbase_Configuration_Manager {
        
        /**
         * Removes all trailing dots recursively from TS settings array
+        * TODO Explain why we remove the dots.
         *
         * @param array $setup The settings array
         * @return void
index 70723c4..d28df9d 100644 (file)
@@ -439,6 +439,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
         * @param array $properties The properties of the object
         * @return array A single row to be inserted in the database
         */
+       // TODO Should we pass an extra flag (UPDATE/INSERT)?
        protected function addCommonFieldsToRow(Tx_Extbase_DomainObject_DomainObjectInterface $object, $parentObject = NULL, $parentPropertyName = NULL, array &$row) {
                $className = get_class($object);
                $dataMap = $this->dataMapper->getDataMap($className);
index 7fcb23e..69997d1 100644 (file)
@@ -470,7 +470,6 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * (non-PHPdoc)
         * @see Classes/Persistence/Tx_Extbase_Persistence_Typo3QueryInterface#useStoragePage($useStoragePage)
         */
-       // TODO move this method to the settings
        public function useStoragePage($useStoragePage) {
                $this->backendSpecificQuerySettings->useStoragePage($useStoragePage);
                return this;
@@ -480,7 +479,6 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * (non-PHPdoc)
         * @see Classes/Persistence/Tx_Extbase_Persistence_Typo3QueryInterface#useEnableFields($useEnableFields)
         */
-       // TODO move this method to the settings
        public function useEnableFields($useEnableFields) {
                $this->backendSpecificQuerySettings->useEnableFields($useEnableFields);
                return this;
diff --git a/typo3/sysext/extbase/Tests/Persistence/Storage/Typo3DbBackend_testcase.php b/typo3/sysext/extbase/Tests/Persistence/Storage/Typo3DbBackend_testcase.php
new file mode 100644 (file)
index 0000000..ac32703
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
+*  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_Persistence_Storage_Typo3DbBackend_testcase extends Tx_Extbase_Base_testcase {
+
+       public function setUp() {
+               
+       }
+
+       /**
+        * @test
+        */
+//     public function anObjectCanBeAttached() {
+//     }
+       
+}
+?>
\ No newline at end of file