[+TASK] Extbase: Fixed unit test for maxitems=1. Thanks to Felix Oertel. Related...
authorJochen Rau <j.rau@web.de>
Thu, 8 Apr 2010 14:59:58 +0000 (14:59 +0000)
committerJochen Rau <j.rau@web.de>
Thu, 8 Apr 2010 14:59:58 +0000 (14:59 +0000)
[+BUGFIX] Extbase (MVC): Fixed a regression, where the & was duplicated in additionalParams. Fixed related unit tests. Related to #7026.

typo3/sysext/extbase/Classes/MVC/Web/Routing/UriBuilder.php
typo3/sysext/extbase/Tests/MVC/Web/Routing/UriBuilder_testcase.php
typo3/sysext/extbase/Tests/Persistence/Mapper/DataMapFactory_testcase.php

index 486b9a4..10a5c38 100644 (file)
@@ -508,7 +508,7 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder {
                if (count($this->arguments) > 0) {
                        $arguments = $this->convertDomainObjectsToIdentityArrays($this->arguments);
                        $this->lastArguments = $arguments;
-                       $typolinkConfiguration['additionalParams'] = '&' . t3lib_div::implodeArrayForUrl(NULL, $arguments);
+                       $typolinkConfiguration['additionalParams'] = t3lib_div::implodeArrayForUrl(NULL, $arguments);
                }
 
                if ($this->addQueryString === TRUE) {
index 1c7c7d5..8eef2af 100644 (file)
@@ -385,7 +385,7 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder_testcase extends Tx_Extbase_BaseTest
                $this->uriBuilder->setTargetPageUid(123);
                $this->uriBuilder->setArguments(array('foo' => 'bar', 'baz' => array('extbase' => 'fluid')));
 
-               $expectedConfiguration = array('parameter' => 123, 'useCacheHash' => 1, 'additionalParams' => '&foo=bar&baz%5Bextbase%5D=fluid');
+               $expectedConfiguration = array('parameter' => 123, 'useCacheHash' => 1, 'additionalParams' => '&foo=bar&baz[extbase]=fluid');
                $actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
 
                $this->assertEquals($expectedConfiguration, $actualConfiguration);
@@ -404,7 +404,7 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder_testcase extends Tx_Extbase_BaseTest
                $this->uriBuilder->setTargetPageUid(123);
                $this->uriBuilder->setArguments(array('someDomainObject' => $mockDomainObject1, 'baz' => array('someOtherDomainObject' => $mockDomainObject2)));
 
-               $expectedConfiguration = array('parameter' => 123, 'useCacheHash' => 1, 'additionalParams' => '&someDomainObject=123&baz%5BsomeOtherDomainObject%5D=321');
+               $expectedConfiguration = array('parameter' => 123, 'useCacheHash' => 1, 'additionalParams' => '&someDomainObject=123&baz[someOtherDomainObject]=321');
                $actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
 
                $this->assertEquals($expectedConfiguration, $actualConfiguration);
index f4571db..c5213bf 100644 (file)
@@ -51,6 +51,24 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory_testcase extends Tx_Extbase_B
        /**
         * @test
         */
+       public function setRelationsDetectsOneToOneRelationOfTypeSelectWithDefaultMaxitems() {
+               $mockColumnMap = $this->getMock('Tx_Extbase_Persistence_Mapper_ColumnMap', array(), array(), '', FALSE);
+           $columnConfiguration = array(
+                       'type' => 'select',
+                       'foreign_table' => 'tx_myextension_bar',
+                       'foreign_field' => 'parentid',
+                       'foreign_table_field' => 'parenttable'
+                       );
+               $mockDataMap = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Persistence_Mapper_DataMapFactory'), array('setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'), array(), '', FALSE);
+               $mockDataMap->expects($this->once())->method('setOneToOneRelation');
+               $mockDataMap->expects($this->never())->method('setOneToManyRelation');
+               $mockDataMap->expects($this->never())->method('setManyToManyRelation');
+               $mockDataMap->_callRef('setRelations', $mockColumnMap, $columnConfiguration);
+       }
+       
+       /**
+        * @test
+        */
        public function setRelationsDetectsOneToOneRelationOfTypeInline() {
                $mockColumnMap = $this->getMock('Tx_Extbase_Persistence_Mapper_ColumnMap', array(), array(), '', FALSE);
            $columnConfiguration = array(
@@ -76,7 +94,8 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory_testcase extends Tx_Extbase_B
                        'type' => 'select',
                        'foreign_table' => 'tx_myextension_bar',
                        'foreign_field' => 'parentid',
-                       'foreign_table_field' => 'parenttable'
+                       'foreign_table_field' => 'parenttable',
+                       'maxitems' => 9999
                        );
                $mockDataMap = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Persistence_Mapper_DataMapFactory'), array('setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'), array(), '', FALSE);
                $mockDataMap->expects($this->never())->method('setOneToOneRelation');
@@ -94,7 +113,8 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory_testcase extends Tx_Extbase_B
                        'type' => 'inline',
                        'foreign_table' => 'tx_myextension_bar',
                        'foreign_field' => 'parentid',
-                       'foreign_table_field' => 'parenttable'
+                       'foreign_table_field' => 'parenttable',
+                       'maxitems' => 9999
                        );
                $mockDataMap = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Persistence_Mapper_DataMapFactory'), array('setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'), array(), '', FALSE);
                $mockDataMap->expects($this->never())->method('setOneToOneRelation');