[BUGFIX] Do not log deprecation if TCA migration is only about syntax 43/40043/3
authorMarkus Klein <markus.klein@typo3.org>
Sat, 6 Jun 2015 12:42:24 +0000 (14:42 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Tue, 9 Jun 2015 16:48:50 +0000 (18:48 +0200)
Migrating a field definition like 'aField;;;' results in 'aField'.
No functionality is actually migrated, so no deprecation has to be logged.

Resolves: #67328
Releases: master
Change-Id: Ide45f78b3a4cf5dd230fc589f8d106f39723a6b5
Reviewed-on: http://review.typo3.org/40043
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/core/Classes/Migrations/TcaMigration.php
typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php

index 9f15eb0..d51b42c 100644 (file)
@@ -125,6 +125,7 @@ class TcaMigration {
                                $itemList = GeneralUtility::trimExplode(',', $typeArray['showitem'], TRUE);
                                $newFieldStrings = array();
                                foreach ($itemList as $fieldString) {
+                                       $fieldString = rtrim($fieldString, ';');
                                        // Unpack the field definition, migrate and remove as much as possible
                                        // Keep empty parameters in trimExplode here (third parameter FALSE), so position is not changed
                                        $fieldArray = GeneralUtility::trimExplode(';', $fieldString);
@@ -134,6 +135,7 @@ class TcaMigration {
                                                'paletteName' => isset($fieldArray[2]) ? $fieldArray[2] : NULL,
                                                'fieldExtra' => isset($fieldArray[3]) ? $fieldArray[3] : NULL,
                                        );
+                                       $fieldName = $fieldArray['fieldName'];
                                        if (!empty($fieldArray['fieldExtra'])) {
                                                // Move fieldExtra "specConf" to columnsOverrides "defaultExtras"
                                                if (!isset($newTca[$table]['types'][$typeName]['columnsOverrides'])) {
@@ -165,7 +167,7 @@ class TcaMigration {
                                        }
                                        $newFieldString = implode(';', $fieldArray);
                                        if ($newFieldString !== $fieldString) {
-                                               $this->messages[] = 'Changed showitem string of TCA table ' . $table . ' type ' . $typeName . '.';
+                                               $this->messages[] = 'Changed showitem string of TCA table "' . $table . '" type "' . $typeName . '" due to changed field "' . $fieldName . '".';
                                        }
                                        if (!empty($newFieldString)) {
                                                $newFieldStrings[] = $newFieldString;
index 1794dcc..b1267f7 100644 (file)
@@ -360,4 +360,25 @@ class TcaMigrationTest extends UnitTestCase {
                $this->assertEquals($expected, $subject->migrate($input));
        }
 
+       /**
+        * @test
+        */
+       public function migrateSpecialConfigurationAndRemoveShowItemStylePointerConfigDoesNotAddMessageIfOnlySyntaxChanged() {
+               $input = array(
+                       'aTable' => array(
+                               'columns' => array(
+                                       'anotherField' => array(
+                                       ),
+                               ),
+                               'types' => array(
+                                       0 => array(
+                                               'showitem' => 'aField;;;',
+                                       ),
+                               ),
+                       ),
+               );
+               $subject = new TcaMigration();
+               $subject->migrate($input);
+               $this->assertEmpty($subject->getMessages());
+       }
 }