[BUGFIX] Title field disappears after using addToAllTCAtypes() 02/27702/5
authorMichiel Roos <michiel@maxserv.nl>
Tue, 18 Feb 2014 21:17:03 +0000 (22:17 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Fri, 28 Feb 2014 19:08:18 +0000 (20:08 +0100)
Change-Id: Ia7db1d1b3613badc84ca3ee44ce68c154004f135
Resolves: #56080
Releases: 6.2
Reviewed-on: https://review.typo3.org/27702
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php

index cb0e638..b048f6a 100644 (file)
@@ -558,7 +558,7 @@ class ExtensionManagementUtility {
         * @return string The extended list
         */
        static protected function executePositionedStringInsertion($list, $insertionList, $insertionPosition = '') {
-               $list = $newList = trim($list, ', \\t\\n\\r\\0\\x0B');
+               $list = $newList = trim($list, ", \t\n\r\0\x0B");
 
                $insertionList = self::removeDuplicatesForInsertion($insertionList, $list);
 
@@ -569,7 +569,7 @@ class ExtensionManagementUtility {
                        return $insertionList;
                }
                if ($insertionPosition === '') {
-                       return $list . ',' . $insertionList;
+                       return $list . ', ' . $insertionList;
                }
 
                list($location, $positionName) = GeneralUtility::trimExplode(':', $insertionPosition);
index e3712b5..df7cbe2 100644 (file)
@@ -561,6 +561,49 @@ class ExtensionManagementUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                $this->assertEquals('newA, newB, fieldX', $GLOBALS['TCA'][$table]['palettes']['generatedFor-fieldA']['showitem']);
        }
 
+       /**
+        * Data provider for executePositionedStringInsertionTrimsCorrectCharacters
+        * @return array
+        */
+       public function executePositionedStringInsertionTrimsCorrectCharactersDataProvider() {
+               return array(
+                       'normal characters' => array(
+                               'tr0',
+                               'tr0',
+                       ),
+                       'newlines' => array(
+                               "test\n",
+                               'test',
+                       ),
+                       'newlines with carriage return' => array(
+                               "test\r\n",
+                               'test',
+                       ),
+                       'tabs' => array(
+                               "test\t",
+                               'test',
+                       ),
+                       'commas' => array(
+                               "test,",
+                               'test',
+                       ),
+                       'multiple commas with trailing spaces' => array(
+                               "test,,\t, \r\n",
+                               'test',
+                       ),
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider executePositionedStringInsertionTrimsCorrectCharactersDataProvider
+        */
+       public function executePositionedStringInsertionTrimsCorrectCharacters($string, $expectedResult) {
+               $extensionManagementUtility = $this->getAccessibleMock('\\TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility', array('dummy'));
+               $string = $extensionManagementUtility->_call('executePositionedStringInsertion', $string, '');
+               $this->assertEquals($expectedResult, $string);
+       }
+
        /////////////////////////////////////////
        // Tests concerning addTcaSelectItem
        /////////////////////////////////////////