Commit a657cda6 authored by Wouter Wolters's avatar Wouter Wolters Committed by Benni Mack
Browse files

[TASK] Add unit test for colorpicker TCA migration

Also fixes the case when wizards array becomes empty.
We can than safely unset the complete wizards key.

Resolves: #75716
Releases: master
Change-Id: I8b0cc65823b2ec6bf8598b21be2dae3bb174e58b
Reviewed-on: https://review.typo3.org/47731


Reviewed-by: default avatarSusanne Moog <typo3@susannemoog.de>
Tested-by: default avatarSusanne Moog <typo3@susannemoog.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent aa56fd03
......@@ -730,6 +730,9 @@ class TcaMigration
foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizard) {
if (isset($wizard['type']) && ($wizard['type'] === 'colorbox')) {
unset($fieldConfig['config']['wizards'][$wizardName]);
if (empty($fieldConfig['config']['wizards'])) {
unset($fieldConfig['config']['wizards']);
}
$fieldConfig['config']['renderType'] = 'colorpicker';
$this->messages[] = 'The color-picker wizard using \'colorbox\' is deprecated'
......
......@@ -1385,4 +1385,45 @@ class TcaMigrationTest extends UnitTestCase
$subject = new TcaMigration();
$this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
}
/**
* @test
*/
public function migrateRewritesColorpickerWizard()
{
$input = [
'aTable' => [
'columns' => [
'aCol' => [
'config' => [
'wizards' => [
'colorpicker' => [
'type' => 'colorbox',
'title' => 'Color picker',
'module' => [
'name' => 'wizard_colorpicker',
],
'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
],
],
],
],
],
],
];
$expected = [
'aTable' => [
'columns' => [
'aCol' => [
'config' => [
'renderType' => 'colorpicker',
],
],
],
],
];
$subject = new TcaMigration();
$this->assertEquals($expected, $subject->migrate($input));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment