[BUGFIX] Allow typesList=0 when using makeCategorizable 64/48364/6
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 28 May 2016 15:41:50 +0000 (17:41 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 29 May 2016 12:31:13 +0000 (14:31 +0200)
Due to a wrong condition which is using !empty() typesList=0 is not possible.
Change the condition to check this the correct way.

Resolves: #76141
Releases: master, 7.6
Change-Id: Ieca9bd2a59e42d112c4eb8058bd76da8d73b86ab
Reviewed-on: https://review.typo3.org/48364
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Category/CategoryRegistry.php
typo3/sysext/core/Tests/Unit/Category/CategoryRegistryTest.php

index d941015..0d84261 100644 (file)
@@ -279,7 +279,7 @@ class CategoryRegistry implements SingletonInterface
             }
 
             $typesList = '';
-            if (!empty($options['typesList'])) {
+            if (isset($options['typesList']) && $options['typesList'] !== '') {
                 $typesList = $options['typesList'];
             }
 
index 724b32a..5d5cd49 100644 (file)
@@ -46,6 +46,9 @@ class CategoryRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                 'ctrl' => array(),
                 'columns' => array(),
                 'types' => array(
+                    '0' => array(
+                        'showitem' => ''
+                    ),
                     '1' => array(
                         'showitem' => ''
                     )
@@ -269,6 +272,16 @@ class CategoryRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      */
+    public function tabIsOnlyAddedForTypesThatAreSpecifiedInTypesList()
+    {
+        $this->subject->add('text_extension_a', $this->tables['first'], 'categories', array('typesList' => '0'));
+        $this->subject->applyTcaForPreRegisteredTables();
+        $this->assertSame('', $GLOBALS['TCA'][$this->tables['first']]['types'][1]['showitem']);
+    }
+
+    /**
+     * @test
+     */
     public function tabIsAddedOnlyOncePerTable()
     {
         $this->subject->add('text_extension_a', $this->tables['first'], 'categories1');