[!!!][TASK] Drop core 6->7 auto TCA migrations
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Migrations / TcaMigrationTest.php
index b0236ba..eaba40f 100644 (file)
@@ -138,278 +138,6 @@ class TcaMigrationTest extends UnitTestCase
         $this->assertEquals($expected, $subject->migrate($input));
     }
 
-    /**
-     * @test
-     */
-    public function migrateChangesT3editorWizardToT3editorRenderTypeIfNotEnabledByTypeConfig(): void
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'bodytext' => [
-                        'exclude' => true,
-                        'label' => 'aLabel',
-                        'config' => [
-                            'type' => 'text',
-                            'rows' => 42,
-                            'wizards' => [
-                                't3editor' => [
-                                    'type' => 'userFunc',
-                                    'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
-                                    'title' => 't3editor',
-                                    'icon' => 'content-table',
-                                    'module' => [
-                                        'name' => 'wizard_table'
-                                    ],
-                                    'params' => [
-                                        'format' => 'html',
-                                        'style' => 'width:98%; height: 60%;'
-                                    ],
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-        $expected = [
-            'aTable' => [
-                'columns' => [
-                    'bodytext' => [
-                        'exclude' => true,
-                        'label' => 'aLabel',
-                        'config' => [
-                            'type' => 'text',
-                            'renderType' => 't3editor',
-                            'format' => 'html',
-                            'rows' => 42,
-                        ],
-                    ],
-                ],
-            ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateDropsStylePointerFromShowItem(): void
-    {
-        $input = [
-            'aTable' => [
-                'types' => [
-                    0 => [
-                        'showitem' => 'aField,anotherField;with;;;style-pointer,thirdField',
-                    ],
-                    1 => [
-                        'showitem' => 'aField,;;;;only-a-style-pointer,anotherField',
-                    ],
-                ],
-            ],
-        ];
-        $expected = [
-            'aTable' => [
-                'types' => [
-                    0 => [
-                        'showitem' => 'aField,anotherField;with,thirdField',
-                    ],
-                    1 => [
-                        'showitem' => 'aField,anotherField',
-                    ],
-                ],
-            ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateMovesSpecialConfigurationToColumnsOverridesDefaultExtras(): void
-    {
-        $input = [
-            'aTable' => [
-                'types' => [
-                    0 => [
-                        'showitem' => 'aField,anotherField;with;;nowrap,thirdField',
-                    ],
-                ],
-            ],
-        ];
-        $expected = [
-            'aTable' => [
-                'types' => [
-                    0 => [
-                        'showitem' => 'aField,anotherField;with,thirdField',
-                        'columnsOverrides' => [
-                            'anotherField' => [
-                                'config' => [
-                                    'wrap' => 'off',
-                                ]
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateMovesSpecialConfigurationToColumnsOverridesDefaultExtrasAndMergesExistingDefaultExtras(): void
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'anotherField' => [
-                        'defaultExtras' => 'nowrap',
-                        'config' => [
-                            'type' => 'text',
-                        ],
-                    ],
-                ],
-                'types' => [
-                    0 => [
-                        'showitem' => 'aField,anotherField;with;;enable-tab,thirdField',
-                    ],
-                ],
-            ],
-        ];
-        $expected = [
-            'aTable' => [
-                'columns' => [
-                    'anotherField' => [
-                        'config' => [
-                            'wrap' => 'off',
-                            'type' => 'text',
-                        ],
-                    ],
-                ],
-                'types' => [
-                    0 => [
-                        'showitem' => 'aField,anotherField;with,thirdField',
-                        'columnsOverrides' => [
-                            'anotherField' => [
-                                'config' => [
-                                    'wrap' => 'off',
-                                    'enableTabulator' => true,
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateChangesT3editorWizardThatIsEnabledByTypeConfigToRenderTypeInColumnsOverrides(): void
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'bodytext' => [
-                        'exclude' => true,
-                        'label' => 'aLabel',
-                        'config' => [
-                            'type' => 'text',
-                            'rows' => 42,
-                            'wizards' => [
-                                't3editorHtml' => [
-                                    'type' => 'userFunc',
-                                    'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
-                                    'enableByTypeConfig' => 1,
-                                    'title' => 't3editor',
-                                    'icon' => 'content-table',
-                                    'module' => [
-                                        'name' => 'wizard_table'
-                                    ],
-                                    'params' => [
-                                        'format' => 'html',
-                                        'style' => 'width:98%; height: 60%;'
-                                    ],
-                                ],
-                                't3editorTypoScript' => [
-                                    'type' => 'userFunc',
-                                    'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
-                                    'enableByTypeConfig' => 1,
-                                    'title' => 't3editor',
-                                    'icon' => 'content-table',
-                                    'module' => [
-                                        'name' => 'wizard_table'
-                                    ],
-                                    'params' => [
-                                        'format' => 'typoscript',
-                                        'style' => 'width:98%; height: 60%;'
-                                    ],
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-                'types' => [
-                    'firstType' => [
-                        'showitem' => 'foo,bodytext;;;wizards[t3editorTypoScript|someOtherWizard],bar',
-                    ],
-                    'secondType' => [
-                        'showitem' => 'foo,bodytext;;;nowrap:wizards[t3editorHtml], bar',
-                    ],
-                ],
-            ],
-        ];
-        $expected = [
-            'aTable' => [
-                'columns' => [
-                    'bodytext' => [
-                        'exclude' => true,
-                        'label' => 'aLabel',
-                        'config' => [
-                            'type' => 'text',
-                            'rows' => 42,
-                        ],
-                    ],
-                ],
-                'types' => [
-                    'firstType' => [
-                        'showitem' => 'foo,bodytext,bar',
-                        'columnsOverrides' => [
-                            'bodytext' => [
-                                'config' => [
-                                    'format' => 'typoscript',
-                                    'renderType' => 't3editor',
-                                ],
-                            ],
-                        ],
-                    ],
-                    'secondType' => [
-                        'showitem' => 'foo,bodytext,bar',
-                        'columnsOverrides' => [
-                            'bodytext' => [
-                                'config' => [
-                                    'format' => 'html',
-                                    'renderType' => 't3editor',
-                                    'wrap' => 'off',
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
     /**
      * @test
      */
@@ -493,630 +221,26 @@ class TcaMigrationTest extends UnitTestCase
     /**
      * @test
      */
-    public function migrateShowItemMovesAdditionalPaletteToOwnPaletteDefinition(): void
+    public function migrateKeepsGivenExtensionReference(): void
     {
         $input = [
-            'aTable' => [
-                'types' => [
-                    'firstType' => [
-                        'showitem' => 'field1;field1Label,field2;fieldLabel2;palette1,field2;;palette2',
-                    ],
+                'aTable' => [
+                        'ctrl' => [
+                                'iconfile' => 'EXT:myExt/iconfile.gif',
+                        ],
                 ],
-            ],
         ];
         $expected = [
-            'aTable' => [
-                'types' => [
-                    'firstType' => [
-                        'showitem' => 'field1;field1Label,field2;fieldLabel2,--palette--;;palette1,field2,--palette--;;palette2',
-                    ],
+                'aTable' => [
+                        'ctrl' => [
+                                'iconfile' => 'EXT:myExt/iconfile.gif',
+                        ],
                 ],
-            ],
         ];
         $subject = new TcaMigration();
         $this->assertEquals($expected, $subject->migrate($input));
     }
 
-    /**
-     * @test
-     */
-    public function migrateIconsForFormFieldWizardToNewLocation(): void
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'bodytext' => [
-                        'config' => [
-                            'type' => 'text',
-                            'wizards' => [
-                                't3editorHtml' => [
-                                    'icon' => 'wizard_table.gif',
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        $expected = [
-            'aTable' => [
-                'columns' => [
-                    'bodytext' => [
-                        'config' => [
-                            'type' => 'text',
-                            'wizards' => [
-                                't3editorHtml' => [
-                                    'icon' => 'content-table',
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateExtAndSysextPathToEXTPath(): void
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'foo' => [
-                        'config' => [
-                            'type' => 'select',
-                            'items' => [
-                                ['foo', 0, 'ext/myext/foo/bar.gif'],
-                                ['bar', 1, 'sysext/myext/foo/bar.gif'],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        $expected = [
-            'aTable' => [
-                'columns' => [
-                    'foo' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderType' => 'selectSingle',
-                            'items' => [
-                                ['foo', 0, 'EXT:myext/foo/bar.gif'],
-                                ['bar', 1, 'EXT:myext/foo/bar.gif'],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migratePathWhichStartsWithIToEXTPath(): void
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'foo' => [
-                        'config' => [
-                            'type' => 'select',
-                            'items' => [
-                                ['foo', 0, 'i/tt_content.gif'],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        $expected = [
-            'aTable' => [
-                'columns' => [
-                    'foo' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderType' => 'selectSingle',
-                            'items' => [
-                                ['foo', 0, 'EXT:backend/Resources/Public/Images/tt_content.gif'],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateRemovesIconsInOptionTags(): void
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'foo' => [
-                        'config' => [
-                            'type' => 'select',
-                            'iconsInOptionTags' => 1,
-                        ],
-                    ],
-                ],
-            ],
-        ];
-        $expected = [
-            'aTable' => [
-                'columns' => [
-                    'foo' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderType' => 'selectSingle',
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateRewritesRelativeIconPathToExtensionReference(): void
-    {
-        $input = [
-                'aTable' => [
-                        'ctrl' => [
-                                'iconfile' => '../typo3conf/ext/myExt/iconfile.gif',
-                        ],
-                ],
-        ];
-        $expected = [
-                'aTable' => [
-                        'ctrl' => [
-                                'iconfile' => 'EXT:myExt/iconfile.gif',
-                        ],
-                ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateRewritesIconFilenameOnlyToDefaultT3skinExtensionReference(): void
-    {
-        $input = [
-                'aTable' => [
-                        'ctrl' => [
-                                'iconfile' => 'iconfile.gif',
-                        ],
-                ],
-        ];
-        $expected = [
-                'aTable' => [
-                        'ctrl' => [
-                                'iconfile' => 'EXT:backend/Resources/Public/Images/iconfile.gif',
-                        ],
-                ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateKeepsGivenExtensionReference(): void
-    {
-        $input = [
-                'aTable' => [
-                        'ctrl' => [
-                                'iconfile' => 'EXT:myExt/iconfile.gif',
-                        ],
-                ],
-        ];
-        $expected = [
-                'aTable' => [
-                        'ctrl' => [
-                                'iconfile' => 'EXT:myExt/iconfile.gif',
-                        ],
-                ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateSelectFieldRenderType(): void
-    {
-        $input = [
-            'aTable-do-not-migrate-because-renderType-is-set' => [
-                'columns' => [
-                    'a-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderType' => 'fooBar'
-                        ]
-                    ]
-                ],
-            ],
-            'aTable-do-migrate-because-renderType-is-not-set' => [
-                'columns' => [
-                    'a-tree-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'tree'
-                        ]
-                    ],
-                    'a-singlebox-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'singlebox'
-                        ]
-                    ],
-                    'a-checkbox-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'checkbox'
-                        ]
-                    ],
-                    'an-unknown-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'unknown'
-                        ]
-                    ],
-                    'a-maxitems-column-not-set' => [
-                        'config' => [
-                            'type' => 'select',
-                        ]
-                    ],
-                    'a-maxitems-column-0' => [
-                        'config' => [
-                            'type' => 'select',
-                            'maxitems' => '0'
-                        ]
-                    ],
-                    'a-maxitems-column-1' => [
-                        'config' => [
-                            'type' => 'select',
-                            'maxitems' => '1'
-                        ]
-                    ],
-                    'a-maxitems-column-2' => [
-                        'config' => [
-                            'type' => 'select',
-                            'maxitems' => '2'
-                        ]
-                    ],
-                    'a-tree-column-with-maxitems' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'tree',
-                            'maxitems' => '1'
-                        ]
-                    ],
-                    'a-singlebox-column-with-maxitems' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'singlebox',
-                            'maxitems' => '1'
-                        ]
-                    ],
-                    'a-checkbox-column-with-maxitems' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'checkbox',
-                            'maxitems' => '1'
-                        ]
-                    ],
-                ],
-            ],
-        ];
-        $expected = [
-            'aTable-do-not-migrate-because-renderType-is-set' => [
-                'columns' => [
-                    'a-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderType' => 'fooBar'
-                        ]
-                    ]
-                ],
-            ],
-            'aTable-do-migrate-because-renderType-is-not-set' => [
-                'columns' => [
-                    'a-tree-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'tree',
-                            'renderType' => 'selectTree'
-                        ]
-                    ],
-                    'a-singlebox-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'singlebox',
-                            'renderType' => 'selectSingleBox'
-                        ]
-                    ],
-                    'a-checkbox-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'checkbox',
-                            'renderType' => 'selectCheckBox'
-                        ]
-                    ],
-                    'an-unknown-column' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'unknown'
-                        ]
-                    ],
-                    'a-maxitems-column-not-set' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderType' => 'selectSingle'
-                        ]
-                    ],
-                    'a-maxitems-column-0' => [
-                        'config' => [
-                            'type' => 'select',
-                            'maxitems' => '0',
-                            'renderType' => 'selectSingle'
-                        ]
-                    ],
-                    'a-maxitems-column-1' => [
-                        'config' => [
-                            'type' => 'select',
-                            'maxitems' => 1,
-                            'renderType' => 'selectSingle'
-                        ]
-                    ],
-                    'a-maxitems-column-2' => [
-                        'config' => [
-                            'type' => 'select',
-                            'maxitems' => 2,
-                            'renderType' => 'selectMultipleSideBySide'
-                        ]
-                    ],
-                    'a-tree-column-with-maxitems' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'tree',
-                            'renderType' => 'selectTree',
-                            'maxitems' => '1'
-                        ]
-                    ],
-                    'a-singlebox-column-with-maxitems' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'singlebox',
-                            'renderType' => 'selectSingleBox',
-                            'maxitems' => '1'
-                        ]
-                    ],
-                    'a-checkbox-column-with-maxitems' => [
-                        'config' => [
-                            'type' => 'select',
-                            'renderMode' => 'checkbox',
-                            'renderType' => 'selectCheckBox',
-                            'maxitems' => '1'
-                        ]
-                    ],
-                ],
-            ],
-        ];
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @return array
-     */
-    public function migrateSetsShowIconTableIfMissingDataProvider(): array
-    {
-        return [
-            'not-a-select-is-kept' => [
-                [
-                    // Given config section
-                    'type' => 'input',
-                ],
-                [
-                    // Expected config section
-                    'type' => 'input',
-                ],
-            ],
-            'not-a-selectSingle-is-kept' => [
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectCheckBox',
-                ],
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectCheckBox',
-                ],
-            ],
-            'noIconsBelowSelect-true-is-removed' => [
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                    'noIconsBelowSelect' => true,
-                ],
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                ],
-            ],
-            'noIconsBelowSelect-false-is-removed-sets-field-wizard' => [
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                    'noIconsBelowSelect' => false,
-                ],
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                    'fieldWizard' => [
-                        'selectIcons' => [
-                            'disabled' => false,
-                        ],
-                    ],
-                ],
-            ],
-            'noIconsBelowSelect-false-is-removes-given-showIconTable-false' => [
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                    'noIconsBelowSelect' => false,
-                    'showIconTable' => false,
-                ],
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                ],
-            ],
-            'suppress-icons-1-is-removed' => [
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                    'suppress_icons' => '1',
-                ],
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                ],
-            ],
-            'suppress-icons-value-is-removed' => [
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                    'suppress_icons' => 'IF_VALUE_FALSE',
-                ],
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                ],
-            ],
-            'selicon-cols-is-removed' => [
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                    'selicon_cols' => 16,
-                ],
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                ],
-            ],
-            'foreign_table_loadIcons-is-removed' => [
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                    'foreign_table_loadIcons' => true,
-                ],
-                [
-                    'type' => 'select',
-                    'renderType' => 'selectSingle',
-                ],
-            ],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider migrateSetsShowIconTableIfMissingDataProvider
-     * @param array $givenConfig
-     * @param array $expectedConfig
-     */
-    public function migrateSetsShowIconTableIfMissing(array $givenConfig, array $expectedConfig): void
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'aField' => [
-                        'config' => $givenConfig,
-                    ]
-                ],
-            ],
-        ];
-        $expected = $input;
-        $expected['aTable']['columns']['aField']['config'] = $expectedConfig;
-
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
-    /**
-     * @test
-     */
-    public function migrateFixesReferenceToLinkHandler()
-    {
-        $input = [
-            'aTable' => [
-                'columns' => [
-                    'aCol' => [
-                        'config' => [
-                            'type' => 'input',
-                            'wizards' => [
-                                'link' => [
-                                    'module' => [
-                                        'name' => 'wizard_element_browser',
-                                        'urlParameters' => [
-                                            'mode' => 'wizard'
-                                        ]
-                                    ],
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-        $expected = [
-            'aTable' => [
-                'columns' => [
-                    'aCol' => [
-                        'config' => [
-                            'type' => 'input',
-                            'wizards' => [
-                                'link' => [
-                                    'module' => [
-                                        'name' => 'wizard_link',
-                                    ],
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        $subject = new TcaMigration();
-        $this->assertEquals($expected, $subject->migrate($input));
-    }
-
     /**
      * @return array
      */