[TASK] Fix CGL errors
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Migrations / TcaMigrationTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Unit\Migrations;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Tests\UnitTestCase;
18 use TYPO3\CMS\Core\Migrations\TcaMigration;
19
20 /**
21 * Test case
22 */
23 class TcaMigrationTest extends UnitTestCase
24 {
25 /**
26 * @test
27 */
28 public function migrateReturnsGivenArrayUnchangedIfNoMigrationNeeded()
29 {
30 $input = $expected = array(
31 'aTable' => array(
32 'ctrl' => array(
33 'aKey' => 'aValue',
34 ),
35 'columns' => array(
36 'aField' => array(
37 'label' => 'foo',
38 'config' => array(
39 'type' => 'aType',
40 'lolli' => 'did this',
41 )
42 ),
43 ),
44 'types' => array(
45 0 => array(
46 'showitem' => 'this,should;stay,this,too',
47 ),
48 ),
49 ),
50 );
51 $subject = new TcaMigration();
52 $this->assertEquals($expected, $subject->migrate($input));
53 }
54
55 /**
56 * @test
57 */
58 public function migrateChangesT3editorWizardToT3editorRenderTypeIfNotEnabledByTypeConfig()
59 {
60 $input = array(
61 'aTable' => array(
62 'columns' => array(
63 'bodytext' => array(
64 'exclude' => 1,
65 'label' => 'aLabel',
66 'config' => array(
67 'type' => 'text',
68 'rows' => 42,
69 'wizards' => array(
70 't3editor' => array(
71 'type' => 'userFunc',
72 'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
73 'title' => 't3editor',
74 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_table.gif',
75 'module' => array(
76 'name' => 'wizard_table'
77 ),
78 'params' => array(
79 'format' => 'html',
80 'style' => 'width:98%; height: 60%;'
81 ),
82 ),
83 ),
84 ),
85 ),
86 ),
87 ),
88 );
89 $expected = array(
90 'aTable' => array(
91 'columns' => array(
92 'bodytext' => array(
93 'exclude' => 1,
94 'label' => 'aLabel',
95 'config' => array(
96 'type' => 'text',
97 'renderType' => 't3editor',
98 'format' => 'html',
99 'rows' => 42,
100 ),
101 ),
102 ),
103 ),
104 );
105 $subject = new TcaMigration();
106 $this->assertEquals($expected, $subject->migrate($input));
107 }
108
109 /**
110 * @test
111 */
112 public function migrateDropsStylePointerFromShowItem()
113 {
114 $input = array(
115 'aTable' => array(
116 'types' => array(
117 0 => array(
118 'showitem' => 'aField,anotherField;with;;;style-pointer,thirdField',
119 ),
120 1 => array(
121 'showitem' => 'aField,;;;;only-a-style-pointer,anotherField',
122 ),
123 ),
124 ),
125 );
126 $expected = array(
127 'aTable' => array(
128 'types' => array(
129 0 => array(
130 'showitem' => 'aField,anotherField;with,thirdField',
131 ),
132 1 => array(
133 'showitem' => 'aField,anotherField',
134 ),
135 ),
136 ),
137 );
138 $subject = new TcaMigration();
139 $this->assertEquals($expected, $subject->migrate($input));
140 }
141
142 /**
143 * @test
144 */
145 public function migrateMovesSpecialConfigurationToColumnsOverridesDefaultExtras()
146 {
147 $input = array(
148 'aTable' => array(
149 'types' => array(
150 0 => array(
151 'showitem' => 'aField,anotherField;with;;special:configuration,thirdField',
152 ),
153 ),
154 ),
155 );
156 $expected = array(
157 'aTable' => array(
158 'types' => array(
159 0 => array(
160 'showitem' => 'aField,anotherField;with,thirdField',
161 'columnsOverrides' => array(
162 'anotherField' => array(
163 'defaultExtras' => 'special:configuration',
164 ),
165 ),
166 ),
167 ),
168 ),
169 );
170 $subject = new TcaMigration();
171 $this->assertEquals($expected, $subject->migrate($input));
172 }
173
174 /**
175 * @test
176 */
177 public function migrateMovesSpecialConfigurationToColumnsOverridesDefaultExtrasAndMergesExistingDefaultExtras()
178 {
179 $input = array(
180 'aTable' => array(
181 'columns' => array(
182 'anotherField' => array(
183 'defaultExtras' => 'some:values',
184 ),
185 ),
186 'types' => array(
187 0 => array(
188 'showitem' => 'aField,anotherField;with;;special:configuration,thirdField',
189 ),
190 ),
191 ),
192 );
193 $expected = array(
194 'aTable' => array(
195 'columns' => array(
196 'anotherField' => array(
197 'defaultExtras' => 'some:values',
198 ),
199 ),
200 'types' => array(
201 0 => array(
202 'showitem' => 'aField,anotherField;with,thirdField',
203 'columnsOverrides' => array(
204 'anotherField' => array(
205 'defaultExtras' => 'some:values:special:configuration',
206 ),
207 ),
208 ),
209 ),
210 ),
211 );
212 $subject = new TcaMigration();
213 $this->assertEquals($expected, $subject->migrate($input));
214 }
215
216 /**
217 * @test
218 */
219 public function migrateChangesT3editorWizardThatIsEnabledByTypeConfigToRenderTypeInColmnnsOverrides()
220 {
221 $input = array(
222 'aTable' => array(
223 'columns' => array(
224 'bodytext' => array(
225 'exclude' => 1,
226 'label' => 'aLabel',
227 'config' => array(
228 'type' => 'text',
229 'rows' => 42,
230 'wizards' => array(
231 't3editorHtml' => array(
232 'type' => 'userFunc',
233 'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
234 'enableByTypeConfig' => 1,
235 'title' => 't3editor',
236 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_table.gif',
237 'module' => array(
238 'name' => 'wizard_table'
239 ),
240 'params' => array(
241 'format' => 'html',
242 'style' => 'width:98%; height: 60%;'
243 ),
244 ),
245 't3editorTypoScript' => array(
246 'type' => 'userFunc',
247 'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
248 'enableByTypeConfig' => 1,
249 'title' => 't3editor',
250 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_table.gif',
251 'module' => array(
252 'name' => 'wizard_table'
253 ),
254 'params' => array(
255 'format' => 'typoscript',
256 'style' => 'width:98%; height: 60%;'
257 ),
258 ),
259 ),
260 ),
261 ),
262 ),
263 'types' => array(
264 'firstType' => array(
265 'showitem' => 'foo,bodytext;;;wizards[t3editorTypoScript|someOtherWizard],bar',
266 ),
267 'secondType' => array(
268 'showitem' => 'foo,bodytext;;;nowrap:wizards[t3editorHtml], bar',
269 ),
270 ),
271 ),
272 );
273 $expected = array(
274 'aTable' => array(
275 'columns' => array(
276 'bodytext' => array(
277 'exclude' => 1,
278 'label' => 'aLabel',
279 'config' => array(
280 'type' => 'text',
281 'rows' => 42,
282 ),
283 ),
284 ),
285 'types' => array(
286 'firstType' => array(
287 'showitem' => 'foo,bodytext,bar',
288 'columnsOverrides' => array(
289 'bodytext' => array(
290 'config' => array(
291 'format' => 'typoscript',
292 'renderType' => 't3editor',
293 ),
294 'defaultExtras' => 'wizards[someOtherWizard]',
295 ),
296 ),
297 ),
298 'secondType' => array(
299 'showitem' => 'foo,bodytext,bar',
300 'columnsOverrides' => array(
301 'bodytext' => array(
302 'config' => array(
303 'format' => 'html',
304 'renderType' => 't3editor',
305 ),
306 'defaultExtras' => 'nowrap',
307 ),
308 ),
309 ),
310 ),
311 ),
312 );
313 $subject = new TcaMigration();
314 $this->assertEquals($expected, $subject->migrate($input));
315 }
316
317 /**
318 * @test
319 */
320 public function migrateRemovesAnUnusedT3edtiorDefinitionIfEnabledByTypeConfig()
321 {
322 $input = array(
323 'aTable' => array(
324 'columns' => array(
325 'bodytext' => array(
326 'exclude' => 1,
327 'label' => 'aLabel',
328 'config' => array(
329 'type' => 'text',
330 'rows' => 42,
331 'wizards' => array(
332 't3editorHtml' => array(
333 'type' => 'userFunc',
334 'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
335 'enableByTypeConfig' => 1,
336 'title' => 't3editor',
337 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_table.gif',
338 'module' => array(
339 'name' => 'wizard_table'
340 ),
341 'params' => array(
342 'format' => 'html',
343 'style' => 'width:98%; height: 60%;'
344 ),
345 ),
346 ),
347 ),
348 ),
349 ),
350 ),
351 );
352 $expected = array(
353 'aTable' => array(
354 'columns' => array(
355 'bodytext' => array(
356 'exclude' => 1,
357 'label' => 'aLabel',
358 'config' => array(
359 'type' => 'text',
360 'rows' => 42,
361 ),
362 ),
363 ),
364 ),
365 );
366 $subject = new TcaMigration();
367 $this->assertEquals($expected, $subject->migrate($input));
368 }
369
370 /**
371 * @test
372 */
373 public function migrateSpecialConfigurationAndRemoveShowItemStylePointerConfigDoesNotAddMessageIfOnlySyntaxChanged()
374 {
375 $input = array(
376 'aTable' => array(
377 'columns' => array(
378 'anotherField' => array(
379 ),
380 ),
381 'types' => array(
382 0 => array(
383 'showitem' => 'aField;;;',
384 ),
385 ),
386 ),
387 );
388 $subject = new TcaMigration();
389 $subject->migrate($input);
390 $this->assertEmpty($subject->getMessages());
391 }
392
393 /**
394 * @test
395 */
396 public function migrateShowItemMovesAdditionalPaletteToOwnPaletteDefinition()
397 {
398 $input = array(
399 'aTable' => array(
400 'types' => array(
401 'firstType' => array(
402 'showitem' => 'field1;field1Label,field2;fieldLabel2;palette1,field2;;palette2',
403 ),
404 ),
405 ),
406 );
407 $expected = array(
408 'aTable' => array(
409 'types' => array(
410 'firstType' => array(
411 'showitem' => 'field1;field1Label,field2;fieldLabel2,--palette--;;palette1,field2,--palette--;;palette2',
412 ),
413 ),
414 ),
415 );
416 $subject = new TcaMigration();
417 $this->assertEquals($expected, $subject->migrate($input));
418 }
419
420 /**
421 * @test
422 */
423 public function migrateIconsForFormFieldWizardsToNewLocation()
424 {
425 $input = array(
426 'aTable' => array(
427 'columns' => array(
428 'bodytext' => array(
429 'config' => array(
430 'wizards' => array(
431 't3editorHtml' => array(
432 'icon' => 'wizard_table.gif',
433 ),
434 ),
435 ),
436 ),
437 ),
438 ),
439 );
440
441 $expected = array(
442 'aTable' => array(
443 'columns' => array(
444 'bodytext' => array(
445 'config' => array(
446 'wizards' => array(
447 't3editorHtml' => array(
448 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_table.gif',
449 ),
450 ),
451 ),
452 ),
453 ),
454 ),
455 );
456
457 $subject = new TcaMigration();
458 $this->assertEquals($expected, $subject->migrate($input));
459 }
460
461 /**
462 * @test
463 */
464 public function migrateExtAndSysextPathToEXTPath()
465 {
466 $input = array(
467 'aTable' => array(
468 'columns' => array(
469 'foo' => array(
470 'config' => array(
471 'type' => 'select',
472 'items' => array(
473 array('foo', 0, 'ext/myext/foo/bar.gif'),
474 array('bar', 1, 'sysext/myext/foo/bar.gif'),
475 ),
476 ),
477 ),
478 ),
479 ),
480 );
481
482 $expected = array(
483 'aTable' => array(
484 'columns' => array(
485 'foo' => array(
486 'config' => array(
487 'type' => 'select',
488 'renderType' => 'selectSingle',
489 'items' => array(
490 array('foo', 0, 'EXT:myext/foo/bar.gif'),
491 array('bar', 1, 'EXT:myext/foo/bar.gif'),
492 ),
493 ),
494 ),
495 ),
496 ),
497 );
498
499 $subject = new TcaMigration();
500 $this->assertEquals($expected, $subject->migrate($input));
501 }
502
503 /**
504 * @test
505 */
506 public function migratePathWhichStartsWithIToEXTPath()
507 {
508 $input = array(
509 'aTable' => array(
510 'columns' => array(
511 'foo' => array(
512 'config' => array(
513 'type' => 'select',
514 'items' => array(
515 array('foo', 0, 'i/tt_content.gif'),
516 ),
517 ),
518 ),
519 ),
520 ),
521 );
522
523 $expected = array(
524 'aTable' => array(
525 'columns' => array(
526 'foo' => array(
527 'config' => array(
528 'type' => 'select',
529 'renderType' => 'selectSingle',
530 'items' => array(
531 array('foo', 0, 'EXT:t3skin/icons/gfx/i/tt_content.gif'),
532 ),
533 ),
534 ),
535 ),
536 ),
537 );
538
539 $subject = new TcaMigration();
540 $this->assertEquals($expected, $subject->migrate($input));
541 }
542
543 /**
544 * @test
545 */
546 public function migrateRemovesIconsInOptionTags()
547 {
548 $input = array(
549 'aTable' => array(
550 'columns' => array(
551 'foo' => array(
552 'config' => array(
553 'type' => 'select',
554 'iconsInOptionTags' => 1,
555 ),
556 ),
557 ),
558 ),
559 );
560 $expected = array(
561 'aTable' => array(
562 'columns' => array(
563 'foo' => array(
564 'config' => array(
565 'type' => 'select',
566 'renderType' => 'selectSingle',
567 ),
568 ),
569 ),
570 ),
571 );
572
573 $subject = new TcaMigration();
574 $this->assertEquals($expected, $subject->migrate($input));
575 }
576
577 /**
578 * @test
579 */
580 public function migrateRewritesRelativeIconPathToExtensionReference()
581 {
582 $input = [
583 'aTable' => [
584 'ctrl' => [
585 'iconfile' => '../typo3conf/ext/myExt/iconfile.gif',
586 ],
587 ],
588 ];
589 $expected = [
590 'aTable' => [
591 'ctrl' => [
592 'iconfile' => 'EXT:myExt/iconfile.gif',
593 ],
594 ],
595 ];
596 $subject = new TcaMigration();
597 $this->assertEquals($expected, $subject->migrate($input));
598 }
599
600 /**
601 * @test
602 */
603 public function migrateRewritesIconFilenameOnlyToDefaultT3skinExtensionReference()
604 {
605 $input = [
606 'aTable' => [
607 'ctrl' => [
608 'iconfile' => 'iconfile.gif',
609 ],
610 ],
611 ];
612 $expected = [
613 'aTable' => [
614 'ctrl' => [
615 'iconfile' => 'EXT:t3skin/icons/gfx/i/iconfile.gif',
616 ],
617 ],
618 ];
619 $subject = new TcaMigration();
620 $this->assertEquals($expected, $subject->migrate($input));
621 }
622
623 /**
624 * @test
625 */
626 public function migrateKeepsGivenExtensionReference()
627 {
628 $input = [
629 'aTable' => [
630 'ctrl' => [
631 'iconfile' => 'EXT:myExt/iconfile.gif',
632 ],
633 ],
634 ];
635 $expected = [
636 'aTable' => [
637 'ctrl' => [
638 'iconfile' => 'EXT:myExt/iconfile.gif',
639 ],
640 ],
641 ];
642 $subject = new TcaMigration();
643 $this->assertEquals($expected, $subject->migrate($input));
644 }
645
646 /**
647 * @test
648 */
649 public function migrateSelectFieldRenderType()
650 {
651 $input = [
652 'aTable-do-not-migrate-because-renderType-is-set' => [
653 'columns' => [
654 'a-column' => [
655 'config' => [
656 'type' => 'select',
657 'renderType' => 'fooBar'
658 ]
659 ]
660 ],
661 ],
662 'aTable-do-migrate-because-renderType-is-not-set' => [
663 'columns' => [
664 'a-tree-column' => [
665 'config' => [
666 'type' => 'select',
667 'renderMode' => 'tree'
668 ]
669 ],
670 'a-singlebox-column' => [
671 'config' => [
672 'type' => 'select',
673 'renderMode' => 'singlebox'
674 ]
675 ],
676 'a-checkbox-column' => [
677 'config' => [
678 'type' => 'select',
679 'renderMode' => 'checkbox'
680 ]
681 ],
682 'an-unknown-column' => [
683 'config' => [
684 'type' => 'select',
685 'renderMode' => 'unknown'
686 ]
687 ],
688 'a-maxitems-column-not-set' => [
689 'config' => [
690 'type' => 'select',
691 ]
692 ],
693 'a-maxitems-column-0' => [
694 'config' => [
695 'type' => 'select',
696 'maxitems' => '0'
697 ]
698 ],
699 'a-maxitems-column-1' => [
700 'config' => [
701 'type' => 'select',
702 'maxitems' => '1'
703 ]
704 ],
705 'a-maxitems-column-2' => [
706 'config' => [
707 'type' => 'select',
708 'maxitems' => '2'
709 ]
710 ],
711 'a-tree-column-with-maxitems' => [
712 'config' => [
713 'type' => 'select',
714 'renderMode' => 'tree',
715 'maxitems' => '1'
716 ]
717 ],
718 'a-singlebox-column-with-maxitems' => [
719 'config' => [
720 'type' => 'select',
721 'renderMode' => 'singlebox',
722 'maxitems' => '1'
723 ]
724 ],
725 'a-checkbox-column-with-maxitems' => [
726 'config' => [
727 'type' => 'select',
728 'renderMode' => 'checkbox',
729 'maxitems' => '1'
730 ]
731 ],
732 ],
733 ],
734 ];
735 $expected = [
736 'aTable-do-not-migrate-because-renderType-is-set' => [
737 'columns' => [
738 'a-column' => [
739 'config' => [
740 'type' => 'select',
741 'renderType' => 'fooBar'
742 ]
743 ]
744 ],
745 ],
746 'aTable-do-migrate-because-renderType-is-not-set' => [
747 'columns' => [
748 'a-tree-column' => [
749 'config' => [
750 'type' => 'select',
751 'renderMode' => 'tree',
752 'renderType' => 'selectTree'
753 ]
754 ],
755 'a-singlebox-column' => [
756 'config' => [
757 'type' => 'select',
758 'renderMode' => 'singlebox',
759 'renderType' => 'selectSingleBox'
760 ]
761 ],
762 'a-checkbox-column' => [
763 'config' => [
764 'type' => 'select',
765 'renderMode' => 'checkbox',
766 'renderType' => 'selectCheckBox'
767 ]
768 ],
769 'an-unknown-column' => [
770 'config' => [
771 'type' => 'select',
772 'renderMode' => 'unknown'
773 ]
774 ],
775 'a-maxitems-column-not-set' => [
776 'config' => [
777 'type' => 'select',
778 'renderType' => 'selectSingle'
779 ]
780 ],
781 'a-maxitems-column-0' => [
782 'config' => [
783 'type' => 'select',
784 'maxitems' => '0',
785 'renderType' => 'selectSingle'
786 ]
787 ],
788 'a-maxitems-column-1' => [
789 'config' => [
790 'type' => 'select',
791 'maxitems' => '1',
792 'renderType' => 'selectSingle'
793 ]
794 ],
795 'a-maxitems-column-2' => [
796 'config' => [
797 'type' => 'select',
798 'maxitems' => '2',
799 'renderType' => 'selectMultipleSideBySide'
800 ]
801 ],
802 'a-tree-column-with-maxitems' => [
803 'config' => [
804 'type' => 'select',
805 'renderMode' => 'tree',
806 'renderType' => 'selectTree',
807 'maxitems' => '1'
808 ]
809 ],
810 'a-singlebox-column-with-maxitems' => [
811 'config' => [
812 'type' => 'select',
813 'renderMode' => 'singlebox',
814 'renderType' => 'selectSingleBox',
815 'maxitems' => '1'
816 ]
817 ],
818 'a-checkbox-column-with-maxitems' => [
819 'config' => [
820 'type' => 'select',
821 'renderMode' => 'checkbox',
822 'renderType' => 'selectCheckBox',
823 'maxitems' => '1'
824 ]
825 ],
826 ],
827 ],
828 ];
829 $subject = new TcaMigration();
830 $this->assertEquals($expected, $subject->migrate($input));
831 }
832
833 /**
834 * @return array
835 */
836 public function migrateSetsShowIconTableIfMissingDataProvider()
837 {
838 return [
839 'not-a-select-is-kept' => [
840 [
841 // Given config section
842 'type' => 'input',
843 ],
844 [
845 // Expected config section
846 'type' => 'input',
847 ],
848 ],
849 'not-a-selectSingle-is-kept' => [
850 [
851 'type' => 'select',
852 'renderType' => 'selectCheckBox',
853 ],
854 [
855 'type' => 'select',
856 'renderType' => 'selectCheckBox',
857 ],
858 ],
859 'noIconsBelowSelect-true-is-removed' => [
860 [
861 'type' => 'select',
862 'renderType' => 'selectSingle',
863 'noIconsBelowSelect' => true,
864 ],
865 [
866 'type' => 'select',
867 'renderType' => 'selectSingle',
868 ],
869 ],
870 'noIconsBelowSelect-false-is-removed-sets-showIconTable' => [
871 [
872 'type' => 'select',
873 'renderType' => 'selectSingle',
874 'noIconsBelowSelect' => false,
875 ],
876 [
877 'type' => 'select',
878 'renderType' => 'selectSingle',
879 'showIconTable' => true,
880 ],
881 ],
882 'noIconsBelowSelect-false-is-removed-keeps-given-showIconTable' => [
883 [
884 'type' => 'select',
885 'renderType' => 'selectSingle',
886 'noIconsBelowSelect' => false,
887 'showIconTable' => false,
888 ],
889 [
890 'type' => 'select',
891 'renderType' => 'selectSingle',
892 'showIconTable' => false,
893 ],
894 ],
895 'suppress-icons-1-is-removed' => [
896 [
897 'type' => 'select',
898 'renderType' => 'selectSingle',
899 'suppress_icons' => '1',
900 ],
901 [
902 'type' => 'select',
903 'renderType' => 'selectSingle',
904 ],
905 ],
906 'suppress-icons-value-is-removed' => [
907 [
908 'type' => 'select',
909 'renderType' => 'selectSingle',
910 'suppress_icons' => 'IF_VALUE_FALSE',
911 ],
912 [
913 'type' => 'select',
914 'renderType' => 'selectSingle',
915 ],
916 ],
917 'selicon-cols-sets-showIconTable' => [
918 [
919 'type' => 'select',
920 'renderType' => 'selectSingle',
921 'selicon_cols' => 16,
922 ],
923 [
924 'type' => 'select',
925 'renderType' => 'selectSingle',
926 'selicon_cols' => 16,
927 'showIconTable' => true,
928 ],
929 ],
930 'selicon-cols-does-not-override-given-showIconTable' => [
931 [
932 'type' => 'select',
933 'renderType' => 'selectSingle',
934 'selicon_cols' => 16,
935 'showIconTable' => false,
936 ],
937 [
938 'type' => 'select',
939 'renderType' => 'selectSingle',
940 'selicon_cols' => 16,
941 'showIconTable' => false,
942 ],
943 ],
944 'foreign_table_loadIcons-is-removed' => [
945 [
946 'type' => 'select',
947 'renderType' => 'selectSingle',
948 'foreign_table_loadIcons' => true,
949 ],
950 [
951 'type' => 'select',
952 'renderType' => 'selectSingle',
953 ],
954 ],
955 ];
956 }
957
958 /**
959 * @test
960 * @dataProvider migrateSetsShowIconTableIfMissingDataProvider
961 * @param array $givenConfig
962 * @param array $expectedConfig
963 */
964 public function migrateSetsShowIconTableIfMissing(array $givenConfig, array $expectedConfig)
965 {
966 $input = [
967 'aTable' => [
968 'columns' => [
969 'aField' => [
970 'config' => $givenConfig,
971 ]
972 ],
973 ],
974 ];
975 $expected = $input;
976 $expected['aTable']['columns']['aField']['config'] = $expectedConfig;
977
978 $subject = new TcaMigration();
979 $this->assertEquals($expected, $subject->migrate($input));
980 }
981
982 /**
983 * @test
984 */
985 public function migrateFixesReferenceToLinkHandler()
986 {
987 $input = [
988 'aTable' => [
989 'columns' => [
990 'aCol' => [
991 'config' => [
992 'wizards' => [
993 'link' => [
994 'module' => [
995 'name' => 'wizard_element_browser',
996 'urlParameters' => [
997 'mode' => 'wizard'
998 ]
999 ],
1000 ],
1001 ],
1002 ],
1003 ],
1004 ],
1005 ],
1006 ];
1007 $expected = [
1008 'aTable' => [
1009 'columns' => [
1010 'aCol' => [
1011 'config' => [
1012 'wizards' => [
1013 'link' => [
1014 'module' => [
1015 'name' => 'wizard_link',
1016 ],
1017 ],
1018 ],
1019 ],
1020 ],
1021 ],
1022 ],
1023 ];
1024
1025 $subject = new TcaMigration();
1026 $this->assertEquals($expected, $subject->migrate($input));
1027 }
1028 }