Extbase:
authorJochen Rau <j.rau@web.de>
Mon, 18 May 2009 08:36:26 +0000 (08:36 +0000)
committerJochen Rau <j.rau@web.de>
Mon, 18 May 2009 08:36:26 +0000 (08:36 +0000)
* Some minor code cleanup
* Added some release notes

typo3/sysext/extbase/Classes/Configuration/Source/TypoScriptSource.php
typo3/sysext/extbase/Classes/Persistence/Mapper/ObjectRelationalMapper.php
typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php
typo3/sysext/extbase/Classes/Property/Mapper.php
typo3/sysext/extbase/RELEASE_NOTES.txt [new file with mode: 0644]
typo3/sysext/extbase/Tests/Base_testcase.php
typo3/sysext/extbase/Tests/Configuration/Manager_testcase.php
typo3/sysext/extbase/Tests/MVC/Web/RequestBuilder_testcase.php
typo3/sysext/extbase/Tests/Persistence/ObjectStorage_testcase.php

index e7b0639..c4a06fb 100644 (file)
@@ -37,6 +37,7 @@ class Tx_Extbase_Configuration_Source_TypoScriptSource implements Tx_Extbase_Con
         * @return array The settings as array without trailing dots
         */
         public function load($extensionName) {
+               // TODO Needs a FE (does actually not work with BE or CLI)
                $settings = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_' . strtolower($extensionName) . '.'];
                if (is_array($settings)) {
                        $settings = $this->postProcessSettings($settings);
index 4567084..37bcca4 100644 (file)
@@ -386,10 +386,6 @@ class Tx_Extbase_Persistence_Mapper_ObjectRelationalMapper implements Tx_Extbase
                return $join;
        }
 
-       public function map(array $rows) {
-               # code...
-       }
-
        /**
         * reconstitutes domain objects from $rows (array)
         *
@@ -637,7 +633,7 @@ class Tx_Extbase_Persistence_Mapper_ObjectRelationalMapper implements Tx_Extbase
                        $row[$dataMap->getTimestampColumnName()] = time();
                }
                if ($dataMap->hasPidColumn()) {
-                       // FIXME Settings from $this->cObj must be merged into the extension settings in the dispatcher
+                       // TODO  Should we merge the settings from $this->cObj into the extension settings (in the dispatcher)
                        $row['pid'] = !empty($this->cObj->data['pages']) ? $this->cObj->data['pages'] : $GLOBALS['TSFE']->id;
                }
                if ($parentObject instanceof Tx_Extbase_DomainObject_DomainObjectInterface && !empty($parentPropertyName)) {
@@ -722,7 +718,7 @@ class Tx_Extbase_Persistence_Mapper_ObjectRelationalMapper implements Tx_Extbase
                        $deletedColumnName = $dataMap->getDeletedColumnName();
                        $res = $this->persistenceBackend->exec_UPDATEquery(
                                $tableName,
-                               'uid=' . intval($object->getUid()),
+                               'uid=' . intval($object->getUid()), // FIXME If an object is localized the original version gets deleted; this must be solved in the overlay method
                                array($deletedColumnName => 1)
                                );
                } else {
index 1fe8187..0f57e4c 100644 (file)
@@ -165,6 +165,7 @@ class Tx_Extbase_Persistence_ObjectStorage implements Iterator, Countable, Array
                        if ($value === NULL) {
                                $value = $object;
                        }
+                       // TODO Revise this with Karsten
                        $this->storage[spl_object_hash($object)] = $value;
                }
        }
index b12a8c7..3afbaa2 100644 (file)
@@ -86,7 +86,7 @@ class Tx_Extbase_Property_Mapper {
         */
        public function mapAndValidate(array $propertyNames, $source, $target, $optionalPropertyNames = array(), Tx_Extbase_Validation_Validator_ObjectValidatorInterface $targetObjectValidator) {
                $backupProperties = array();
-
+               
                $this->map($propertyNames, $source, $backupProperties, $optionalPropertyNames);
                if ($this->mappingResults->hasErrors()) return FALSE;
 
diff --git a/typo3/sysext/extbase/RELEASE_NOTES.txt b/typo3/sysext/extbase/RELEASE_NOTES.txt
new file mode 100644 (file)
index 0000000..42c9a96
--- /dev/null
@@ -0,0 +1,34 @@
+RELEASE NOTES of Extbase v0.9.0
+===============================
+
+This package contains the Extbase Framework for Extensions. You may 
+also want to install the BlogExample (blog_example) to experiment 
+with. This little example extension demonstrates some of the main 
+features of Extbase. The documentation is bundled in a separate 
+extension called doc_extbase. Both, the blog_example and the 
+doc_extbase can downloaded via TER.
+
+http://typo3.org/extensions/repository/view/blog_example/current/
+http://typo3.org/extensions/repository/view/doc_extbase/current/
+
+Currently Extbase is in ALPHA state. Do not expect everything in the 
+right place and shape. And keep in mind that the API may change 
+until TYPO3 v4.3beta1 is released.
+
+If you have any feature requests or encountered issues regarding 
+this package please use the facilities on forge to report.
+
+We are very open to answer your questions. Please use the newsgroup 
+
+typo3.projects.typo3v4mvc on lists.netfielders.de
+
+so other developers can react to your comments and also 
+profit from the postet solutions. Do not contact a member of the 
+development team via private email (or skype, or visits, or ...) 
+until he accepted this channel. We all do coding for Extbase on 
+our sparetime and must handle our regular work load - and don't 
+forget about our families ;-).
+
+We hope you have fun with this package!
+
+-- Your Extbase Development Team
\ No newline at end of file
index 7bf2e7a..50ba450 100644 (file)
@@ -22,8 +22,6 @@
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 
-require_once(t3lib_extMgm::extPath('extbase', 'Classes/Dispatcher.php'));
-
 /**
  * Base testcase for the Extbase extension. Currently it only registers the autoloader.
  */
index 8ef52f1..1bf79d7 100644 (file)
@@ -50,7 +50,10 @@ class Tx_Extbase_Configuration_Manager_testcase extends Tx_Extbase_Base_testcase
                $this->configurationSources[] = $configurationSource;
        }
        
-       public function test_SettingsCanBeLoaded() {
+       /**
+        * @test
+        */
+       public function settingsCanBeLoaded() {
                $configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_Manager', $this->configurationSources);
                $settings = $configurationManager->getSettings('Tx_Extbase_Foo_Bar');
                $this->assertEquals($this->settings, $settings, 'The retrieved settings differs from the retrieved settings.');         
index 7580a83..65a5f1d 100644 (file)
@@ -53,7 +53,10 @@ class Tx_Extbase_MVC_Web_RequestBuilder_testcase extends Tx_Extbase_Base_testcas
                $this->builder = new Tx_Extbase_MVC_Web_RequestBuilder;
        }
        
-       public function test_BuildReturnsAWebRequestObject() {
+       /**
+        * @test
+        */
+       public function buildReturnsAWebRequestObject() {
                $this->builder->initialize($this->configuration);
                $request = $this->builder->build();
                $this->assertEquals('Tx_Extbase_MVC_Web_Request', get_class($request));
@@ -63,15 +66,21 @@ class Tx_Extbase_MVC_Web_RequestBuilder_testcase extends Tx_Extbase_Base_testcas
                $this->assertEquals('show', $request->getControllerActionName());
        }
        
-       public function test_BuildWithoutConfigurationReturnsAWebRequestObjectWithDefaultSettings() {
+       /**
+        * @test
+        */
+       public function buildWithoutConfigurationReturnsAWebRequestObjectWithDefaultSettings() {
                $request = $this->builder->build();
                $this->assertEquals('plugin', $request->getPluginName());
                $this->assertEquals('Extbase', $request->getControllerExtensionName());
-               $this->assertEquals('Default', $request->getControllerName());
+               $this->assertEquals('Standard', $request->getControllerName());
                $this->assertEquals('index', $request->getControllerActionName());
        }
 
-       public function test_BuildWithMissingControllerConfigurationsReturnsAWebRequestObjectWithDefaultControllerSettings() {
+       /**
+        * @test
+        */
+       public function buildWithMissingControllerConfigurationsReturnsAWebRequestObjectWithDefaultControllerSettings() {
                $configuration = $this->configuration;
                unset($configuration['controller']);
                unset($configuration['action']);
@@ -80,11 +89,14 @@ class Tx_Extbase_MVC_Web_RequestBuilder_testcase extends Tx_Extbase_Base_testcas
                $request = $this->builder->build();
                $this->assertEquals('pi1', $request->getPluginName());
                $this->assertEquals('MyExtension', $request->getControllerExtensionName());
-               $this->assertEquals('Default', $request->getControllerName());
+               $this->assertEquals('Standard', $request->getControllerName());
                $this->assertEquals('index', $request->getControllerActionName());
        }
        
-       public function test_BuildWithMissingActionsReturnsAWebRequestObjectWithDefaultControllerSettings() {
+       /**
+        * @test
+        */
+       public function buildWithMissingActionsReturnsAWebRequestObjectWithDefaultControllerSettings() {
                $configuration = $this->configuration;
                unset($configuration['controller']);
                unset($configuration['action']);
@@ -96,7 +108,10 @@ class Tx_Extbase_MVC_Web_RequestBuilder_testcase extends Tx_Extbase_Base_testcas
                $this->assertEquals('show', $request->getControllerActionName());
        }
 
-       public function test_BuildSetsTheRequestURIInTheRequestObject() {
+       /**
+        * @test
+        */
+       public function buildSetsTheRequestURIInTheRequestObject() {
                $this->builder->initialize($this->configuration);
                $request = $this->builder->build();
                $this->assertEquals(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), $request->getRequestURI());
index e861a94..67d906a 100644 (file)
 
 class Tx_Extbase_Persistence_ObjectStorage_testcase extends Tx_Extbase_Base_testcase {
        
-       public function setUp() {
-       }
-       
-       public function test_AnObjectCanBeAttached() {
+       /**
+        * @test
+        */
+       public function anObjectCanBeAttached() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $object = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                $objectStorage->attach($object);
                $result = $objectStorage->offsetGet($object);
+
                $this->assertEquals($result, $object, 'The retrieved object differs from the attached object.');                
        }
        
-       public function test_AttachingSomethingElseThanAnObjectThrowsAnException() {
-               $this->setExpectedException('Tx_Extbase_Exception_InvalidArgumentType');
+       /**
+        * @test
+        * @expectedException Tx_Extbase_Exception_InvalidArgumentType
+        */
+       public function attachingSomethingElseThanAnObjectThrowsAnException() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $objectStorage->attach('foo');
        }
        
-       public function test_AnObjectCanBeDetached() {
+       /**
+        * @test
+        */
+       public function anObjectCanBeDetached() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $object = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                $objectStorage->offsetSet($object, $object);
                $resultBeforeDetaching = $objectStorage->offsetGet($object);
+
                $this->assertEquals($resultBeforeDetaching, $object, 'The object could not be set via offsetSet().');           
+
                $objectStorage->detach($object);
                $resultAfterDetaching = $objectStorage->offsetGet($object);
+
                $this->assertEquals($resultAfterDetaching, NULL, 'The object could not be detached.');          
        }
        
-       public function test_DetachingSomethingElseThanAnObjectThrowsAnException() {
-               $this->setExpectedException('Tx_Extbase_Exception_InvalidArgumentType');
+       /**
+        * @test
+        * @expectedException Tx_Extbase_Exception_InvalidArgumentType
+        */
+       public function detachingSomethingElseThanAnObjectThrowsAnException() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $objectStorage->detach('foo');
        }
        
-       public function test_AddingAnObjectWithoutAnObjectAsOffsetThrowsAnException() {
-               $this->setExpectedException('Tx_Extbase_Exception_InvalidArgumentType');
+       /**
+        * @test
+        * @expectedException Tx_Extbase_Exception_InvalidArgumentType
+        */
+       public function addingAnObjectWithoutAnObjectAsOffsetThrowsAnException() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $object = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                $objectStorage[] = $object;
        }
                
-       public function test_AnObjectCouldBeSetViaAnOffset() {
+       /**
+        * @test
+        */
+       public function anObjectCouldBeSetViaAnOffset() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $object = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                $objectStorage[$object] = $object;
                $result = $objectStorage->offsetGet($object);
+
                $this->assertEquals($result, $object, 'The retrieved object differs from the attached object.');
        }
        
-       public function test_ItCanBeTestedIfTheStorageContainsAnObject() {
+       /**
+        * @test
+        */
+       public function itCanBeTestedIfTheStorageContainsAnObject() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $object = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                $objectStorage->attach($object);
                $result = $objectStorage->contains($object);
+
                $this->assertEquals($result, TRUE, 'The method object differs from the attached object.');              
        }
        
-       public function test_UnsettingSomethingElseThanAnObjectThrowsAnException() {
-               $this->setExpectedException('Tx_Extbase_Exception_InvalidArgumentType');
+       /**
+        * @test
+        * @expectedException Tx_Extbase_Exception_InvalidArgumentType
+        */
+       public function unsettingSomethingElseThanAnObjectThrowsAnException() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                // $object = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                // $objectStorage->offsetSet($object, $object);
                $objectStorage->offsetUnset('foo');
        }
 
-       public function test_AnObjectCanBeUnset() {
+       /**
+        * @test
+        */
+       public function anObjectCanBeUnset() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $object = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                $objectStorage->offsetSet($object, $object);
                $resultBeforeDetaching = $objectStorage->offsetGet($object);
+
                $this->assertEquals($resultBeforeDetaching, $object, 'The object could not be set via offsetSet().');           
+
                $objectStorage->offsetUnset($object);
                $resultAfterDetaching = $objectStorage->offsetGet($object);
+
                $this->assertEquals($resultAfterDetaching, NULL, 'The object could not be unsetted.');          
        }
 
-       public function test_TheStorageCanBeRetrievedAsArray() {
+       /**
+        * @test
+        */
+       public function theStorageCanBeRetrievedAsArray() {
                $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
                $object1 = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                $objectStorage->offsetSet($object1, $object1);
                $object2 = $this->getMock('Tx_Extbase_DomainObject_AbstractEntity');
                $objectStorage->offsetSet($object2, $object2);
                $result = $objectStorage->toArray();
+
                $this->assertEquals(is_array($result), TRUE, 'The result was not an array as expected.');               
                $this->assertEquals(count($result), 2, 'The retrieved array did not contain two elements.');            
        }