[BUGFIX] Check in TcaMigration if the type is set
[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\Migrations\TcaMigration;
18
19 /**
20 * Test case
21 */
22 class TcaMigrationTest extends \TYPO3\CMS\Components\TestingFramework\Core\UnitTestCase
23 {
24 /**
25 * @test
26 */
27 public function missingTypeThrowsException()
28 {
29 $input = [
30 'aTable' => [
31 'columns' => [
32 'field_a' => [
33 'label' => 'aLabel',
34 'config' => [
35 'type' => 'text',
36 ],
37 ],
38 'field_b' => [
39 'label' => 'bLabel',
40 'config' => [
41 'rows' => 42,
42 'wizards' => []
43 ],
44 ],
45 ],
46 ],
47 ];
48 $this->expectException(\RuntimeException::class);
49 $this->expectExceptionCode(1482394401);
50 $subject = new TcaMigration();
51 $subject->migrate($input);
52 }
53
54 /**
55 * @test
56 */
57 public function migrateReturnsGivenArrayUnchangedIfNoMigrationNeeded()
58 {
59 $input = $expected = [
60 'aTable' => [
61 'ctrl' => [
62 'aKey' => 'aValue',
63 ],
64 'columns' => [
65 'aField' => [
66 'label' => 'foo',
67 'config' => [
68 'type' => 'aType',
69 'lolli' => 'did this',
70 ]
71 ],
72 ],
73 'types' => [
74 0 => [
75 'showitem' => 'this,should;stay,this,too',
76 ],
77 ],
78 ],
79 ];
80 $subject = new TcaMigration();
81 $this->assertEquals($expected, $subject->migrate($input));
82 }
83
84 /**
85 * @test
86 */
87 public function migrateChangesT3editorWizardToT3editorRenderTypeIfNotEnabledByTypeConfig()
88 {
89 $input = [
90 'aTable' => [
91 'columns' => [
92 'bodytext' => [
93 'exclude' => true,
94 'label' => 'aLabel',
95 'config' => [
96 'type' => 'text',
97 'rows' => 42,
98 'wizards' => [
99 't3editor' => [
100 'type' => 'userFunc',
101 'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
102 'title' => 't3editor',
103 'icon' => 'content-table',
104 'module' => [
105 'name' => 'wizard_table'
106 ],
107 'params' => [
108 'format' => 'html',
109 'style' => 'width:98%; height: 60%;'
110 ],
111 ],
112 ],
113 ],
114 ],
115 ],
116 ],
117 ];
118 $expected = [
119 'aTable' => [
120 'columns' => [
121 'bodytext' => [
122 'exclude' => true,
123 'label' => 'aLabel',
124 'config' => [
125 'type' => 'text',
126 'renderType' => 't3editor',
127 'format' => 'html',
128 'rows' => 42,
129 ],
130 ],
131 ],
132 ],
133 ];
134 $subject = new TcaMigration();
135 $this->assertEquals($expected, $subject->migrate($input));
136 }
137
138 /**
139 * @test
140 */
141 public function migrateDropsStylePointerFromShowItem()
142 {
143 $input = [
144 'aTable' => [
145 'types' => [
146 0 => [
147 'showitem' => 'aField,anotherField;with;;;style-pointer,thirdField',
148 ],
149 1 => [
150 'showitem' => 'aField,;;;;only-a-style-pointer,anotherField',
151 ],
152 ],
153 ],
154 ];
155 $expected = [
156 'aTable' => [
157 'types' => [
158 0 => [
159 'showitem' => 'aField,anotherField;with,thirdField',
160 ],
161 1 => [
162 'showitem' => 'aField,anotherField',
163 ],
164 ],
165 ],
166 ];
167 $subject = new TcaMigration();
168 $this->assertEquals($expected, $subject->migrate($input));
169 }
170
171 /**
172 * @test
173 */
174 public function migrateMovesSpecialConfigurationToColumnsOverridesDefaultExtras()
175 {
176 $input = [
177 'aTable' => [
178 'types' => [
179 0 => [
180 'showitem' => 'aField,anotherField;with;;special:configuration,thirdField',
181 ],
182 ],
183 ],
184 ];
185 $expected = [
186 'aTable' => [
187 'types' => [
188 0 => [
189 'showitem' => 'aField,anotherField;with,thirdField',
190 'columnsOverrides' => [
191 'anotherField' => [
192 'defaultExtras' => 'special:configuration',
193 ],
194 ],
195 ],
196 ],
197 ],
198 ];
199 $subject = new TcaMigration();
200 $this->assertEquals($expected, $subject->migrate($input));
201 }
202
203 /**
204 * @test
205 */
206 public function migrateMovesSpecialConfigurationToColumnsOverridesDefaultExtrasAndMergesExistingDefaultExtras()
207 {
208 $input = [
209 'aTable' => [
210 'columns' => [
211 'anotherField' => [
212 'defaultExtras' => 'some:values',
213 ],
214 ],
215 'types' => [
216 0 => [
217 'showitem' => 'aField,anotherField;with;;special:configuration,thirdField',
218 ],
219 ],
220 ],
221 ];
222 $expected = [
223 'aTable' => [
224 'columns' => [
225 'anotherField' => [
226 'defaultExtras' => 'some:values',
227 ],
228 ],
229 'types' => [
230 0 => [
231 'showitem' => 'aField,anotherField;with,thirdField',
232 'columnsOverrides' => [
233 'anotherField' => [
234 'defaultExtras' => 'some:values:special:configuration',
235 ],
236 ],
237 ],
238 ],
239 ],
240 ];
241 $subject = new TcaMigration();
242 $this->assertEquals($expected, $subject->migrate($input));
243 }
244
245 /**
246 * @test
247 */
248 public function migrateChangesT3editorWizardThatIsEnabledByTypeConfigToRenderTypeInColmnnsOverrides()
249 {
250 $input = [
251 'aTable' => [
252 'columns' => [
253 'bodytext' => [
254 'exclude' => true,
255 'label' => 'aLabel',
256 'config' => [
257 'type' => 'text',
258 'rows' => 42,
259 'wizards' => [
260 't3editorHtml' => [
261 'type' => 'userFunc',
262 'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
263 'enableByTypeConfig' => 1,
264 'title' => 't3editor',
265 'icon' => 'content-table',
266 'module' => [
267 'name' => 'wizard_table'
268 ],
269 'params' => [
270 'format' => 'html',
271 'style' => 'width:98%; height: 60%;'
272 ],
273 ],
274 't3editorTypoScript' => [
275 'type' => 'userFunc',
276 'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
277 'enableByTypeConfig' => 1,
278 'title' => 't3editor',
279 'icon' => 'content-table',
280 'module' => [
281 'name' => 'wizard_table'
282 ],
283 'params' => [
284 'format' => 'typoscript',
285 'style' => 'width:98%; height: 60%;'
286 ],
287 ],
288 ],
289 ],
290 ],
291 ],
292 'types' => [
293 'firstType' => [
294 'showitem' => 'foo,bodytext;;;wizards[t3editorTypoScript|someOtherWizard],bar',
295 ],
296 'secondType' => [
297 'showitem' => 'foo,bodytext;;;nowrap:wizards[t3editorHtml], bar',
298 ],
299 ],
300 ],
301 ];
302 $expected = [
303 'aTable' => [
304 'columns' => [
305 'bodytext' => [
306 'exclude' => true,
307 'label' => 'aLabel',
308 'config' => [
309 'type' => 'text',
310 'rows' => 42,
311 ],
312 ],
313 ],
314 'types' => [
315 'firstType' => [
316 'showitem' => 'foo,bodytext,bar',
317 'columnsOverrides' => [
318 'bodytext' => [
319 'config' => [
320 'format' => 'typoscript',
321 'renderType' => 't3editor',
322 ],
323 'defaultExtras' => 'wizards[someOtherWizard]',
324 ],
325 ],
326 ],
327 'secondType' => [
328 'showitem' => 'foo,bodytext,bar',
329 'columnsOverrides' => [
330 'bodytext' => [
331 'config' => [
332 'format' => 'html',
333 'renderType' => 't3editor',
334 ],
335 'defaultExtras' => 'nowrap',
336 ],
337 ],
338 ],
339 ],
340 ],
341 ];
342 $subject = new TcaMigration();
343 $this->assertEquals($expected, $subject->migrate($input));
344 }
345
346 /**
347 * @test
348 */
349 public function migrateRemovesAnUnusedT3edtiorDefinitionIfEnabledByTypeConfig()
350 {
351 $input = [
352 'aTable' => [
353 'columns' => [
354 'bodytext' => [
355 'exclude' => true,
356 'label' => 'aLabel',
357 'config' => [
358 'type' => 'text',
359 'rows' => 42,
360 'wizards' => [
361 't3editorHtml' => [
362 'type' => 'userFunc',
363 'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
364 'enableByTypeConfig' => 1,
365 'title' => 't3editor',
366 'icon' => 'content-table',
367 'module' => [
368 'name' => 'wizard_table'
369 ],
370 'params' => [
371 'format' => 'html',
372 'style' => 'width:98%; height: 60%;'
373 ],
374 ],
375 ],
376 ],
377 ],
378 ],
379 ],
380 ];
381 $expected = [
382 'aTable' => [
383 'columns' => [
384 'bodytext' => [
385 'exclude' => true,
386 'label' => 'aLabel',
387 'config' => [
388 'type' => 'text',
389 'rows' => 42,
390 ],
391 ],
392 ],
393 ],
394 ];
395 $subject = new TcaMigration();
396 $this->assertEquals($expected, $subject->migrate($input));
397 }
398
399 /**
400 * @test
401 */
402 public function migrateSpecialConfigurationAndRemoveShowItemStylePointerConfigDoesNotAddMessageIfOnlySyntaxChanged()
403 {
404 $input = [
405 'aTable' => [
406 'columns' => [
407 'anotherField' => [
408 ],
409 ],
410 'types' => [
411 0 => [
412 'showitem' => 'aField;;;',
413 ],
414 1 => []
415 ],
416 ],
417 ];
418 $subject = new TcaMigration();
419 $subject->migrate($input);
420 $this->assertEmpty($subject->getMessages());
421 }
422
423 /**
424 * @test
425 */
426 public function migrateShowItemMovesAdditionalPaletteToOwnPaletteDefinition()
427 {
428 $input = [
429 'aTable' => [
430 'types' => [
431 'firstType' => [
432 'showitem' => 'field1;field1Label,field2;fieldLabel2;palette1,field2;;palette2',
433 ],
434 ],
435 ],
436 ];
437 $expected = [
438 'aTable' => [
439 'types' => [
440 'firstType' => [
441 'showitem' => 'field1;field1Label,field2;fieldLabel2,--palette--;;palette1,field2,--palette--;;palette2',
442 ],
443 ],
444 ],
445 ];
446 $subject = new TcaMigration();
447 $this->assertEquals($expected, $subject->migrate($input));
448 }
449
450 /**
451 * @test
452 */
453 public function migrateIconsForFormFieldWizardsToNewLocation()
454 {
455 $input = [
456 'aTable' => [
457 'columns' => [
458 'bodytext' => [
459 'config' => [
460 'type' => 'text',
461 'wizards' => [
462 't3editorHtml' => [
463 'icon' => 'wizard_table.gif',
464 ],
465 ],
466 ],
467 ],
468 ],
469 ],
470 ];
471
472 $expected = [
473 'aTable' => [
474 'columns' => [
475 'bodytext' => [
476 'config' => [
477 'type' => 'text',
478 'wizards' => [
479 't3editorHtml' => [
480 'icon' => 'content-table',
481 ],
482 ],
483 ],
484 ],
485 ],
486 ],
487 ];
488
489 $subject = new TcaMigration();
490 $this->assertEquals($expected, $subject->migrate($input));
491 }
492
493 /**
494 * @test
495 */
496 public function migrateExtAndSysextPathToEXTPath()
497 {
498 $input = [
499 'aTable' => [
500 'columns' => [
501 'foo' => [
502 'config' => [
503 'type' => 'select',
504 'items' => [
505 ['foo', 0, 'ext/myext/foo/bar.gif'],
506 ['bar', 1, 'sysext/myext/foo/bar.gif'],
507 ],
508 ],
509 ],
510 ],
511 ],
512 ];
513
514 $expected = [
515 'aTable' => [
516 'columns' => [
517 'foo' => [
518 'config' => [
519 'type' => 'select',
520 'renderType' => 'selectSingle',
521 'items' => [
522 ['foo', 0, 'EXT:myext/foo/bar.gif'],
523 ['bar', 1, 'EXT:myext/foo/bar.gif'],
524 ],
525 ],
526 ],
527 ],
528 ],
529 ];
530
531 $subject = new TcaMigration();
532 $this->assertEquals($expected, $subject->migrate($input));
533 }
534
535 /**
536 * @test
537 */
538 public function migratePathWhichStartsWithIToEXTPath()
539 {
540 $input = [
541 'aTable' => [
542 'columns' => [
543 'foo' => [
544 'config' => [
545 'type' => 'select',
546 'items' => [
547 ['foo', 0, 'i/tt_content.gif'],
548 ],
549 ],
550 ],
551 ],
552 ],
553 ];
554
555 $expected = [
556 'aTable' => [
557 'columns' => [
558 'foo' => [
559 'config' => [
560 'type' => 'select',
561 'renderType' => 'selectSingle',
562 'items' => [
563 ['foo', 0, 'EXT:t3skin/icons/gfx/i/tt_content.gif'],
564 ],
565 ],
566 ],
567 ],
568 ],
569 ];
570
571 $subject = new TcaMigration();
572 $this->assertEquals($expected, $subject->migrate($input));
573 }
574
575 /**
576 * @test
577 */
578 public function migrateRemovesIconsInOptionTags()
579 {
580 $input = [
581 'aTable' => [
582 'columns' => [
583 'foo' => [
584 'config' => [
585 'type' => 'select',
586 'iconsInOptionTags' => 1,
587 ],
588 ],
589 ],
590 ],
591 ];
592 $expected = [
593 'aTable' => [
594 'columns' => [
595 'foo' => [
596 'config' => [
597 'type' => 'select',
598 'renderType' => 'selectSingle',
599 ],
600 ],
601 ],
602 ],
603 ];
604
605 $subject = new TcaMigration();
606 $this->assertEquals($expected, $subject->migrate($input));
607 }
608
609 /**
610 * @test
611 */
612 public function migrateRewritesRelativeIconPathToExtensionReference()
613 {
614 $input = [
615 'aTable' => [
616 'ctrl' => [
617 'iconfile' => '../typo3conf/ext/myExt/iconfile.gif',
618 ],
619 ],
620 ];
621 $expected = [
622 'aTable' => [
623 'ctrl' => [
624 'iconfile' => 'EXT:myExt/iconfile.gif',
625 ],
626 ],
627 ];
628 $subject = new TcaMigration();
629 $this->assertEquals($expected, $subject->migrate($input));
630 }
631
632 /**
633 * @test
634 */
635 public function migrateRewritesIconFilenameOnlyToDefaultT3skinExtensionReference()
636 {
637 $input = [
638 'aTable' => [
639 'ctrl' => [
640 'iconfile' => 'iconfile.gif',
641 ],
642 ],
643 ];
644 $expected = [
645 'aTable' => [
646 'ctrl' => [
647 'iconfile' => 'EXT:t3skin/icons/gfx/i/iconfile.gif',
648 ],
649 ],
650 ];
651 $subject = new TcaMigration();
652 $this->assertEquals($expected, $subject->migrate($input));
653 }
654
655 /**
656 * @test
657 */
658 public function migrateKeepsGivenExtensionReference()
659 {
660 $input = [
661 'aTable' => [
662 'ctrl' => [
663 'iconfile' => 'EXT:myExt/iconfile.gif',
664 ],
665 ],
666 ];
667 $expected = [
668 'aTable' => [
669 'ctrl' => [
670 'iconfile' => 'EXT:myExt/iconfile.gif',
671 ],
672 ],
673 ];
674 $subject = new TcaMigration();
675 $this->assertEquals($expected, $subject->migrate($input));
676 }
677
678 /**
679 * @test
680 */
681 public function migrateSelectFieldRenderType()
682 {
683 $input = [
684 'aTable-do-not-migrate-because-renderType-is-set' => [
685 'columns' => [
686 'a-column' => [
687 'config' => [
688 'type' => 'select',
689 'renderType' => 'fooBar'
690 ]
691 ]
692 ],
693 ],
694 'aTable-do-migrate-because-renderType-is-not-set' => [
695 'columns' => [
696 'a-tree-column' => [
697 'config' => [
698 'type' => 'select',
699 'renderMode' => 'tree'
700 ]
701 ],
702 'a-singlebox-column' => [
703 'config' => [
704 'type' => 'select',
705 'renderMode' => 'singlebox'
706 ]
707 ],
708 'a-checkbox-column' => [
709 'config' => [
710 'type' => 'select',
711 'renderMode' => 'checkbox'
712 ]
713 ],
714 'an-unknown-column' => [
715 'config' => [
716 'type' => 'select',
717 'renderMode' => 'unknown'
718 ]
719 ],
720 'a-maxitems-column-not-set' => [
721 'config' => [
722 'type' => 'select',
723 ]
724 ],
725 'a-maxitems-column-0' => [
726 'config' => [
727 'type' => 'select',
728 'maxitems' => '0'
729 ]
730 ],
731 'a-maxitems-column-1' => [
732 'config' => [
733 'type' => 'select',
734 'maxitems' => '1'
735 ]
736 ],
737 'a-maxitems-column-2' => [
738 'config' => [
739 'type' => 'select',
740 'maxitems' => '2'
741 ]
742 ],
743 'a-tree-column-with-maxitems' => [
744 'config' => [
745 'type' => 'select',
746 'renderMode' => 'tree',
747 'maxitems' => '1'
748 ]
749 ],
750 'a-singlebox-column-with-maxitems' => [
751 'config' => [
752 'type' => 'select',
753 'renderMode' => 'singlebox',
754 'maxitems' => '1'
755 ]
756 ],
757 'a-checkbox-column-with-maxitems' => [
758 'config' => [
759 'type' => 'select',
760 'renderMode' => 'checkbox',
761 'maxitems' => '1'
762 ]
763 ],
764 ],
765 ],
766 ];
767 $expected = [
768 'aTable-do-not-migrate-because-renderType-is-set' => [
769 'columns' => [
770 'a-column' => [
771 'config' => [
772 'type' => 'select',
773 'renderType' => 'fooBar'
774 ]
775 ]
776 ],
777 ],
778 'aTable-do-migrate-because-renderType-is-not-set' => [
779 'columns' => [
780 'a-tree-column' => [
781 'config' => [
782 'type' => 'select',
783 'renderMode' => 'tree',
784 'renderType' => 'selectTree'
785 ]
786 ],
787 'a-singlebox-column' => [
788 'config' => [
789 'type' => 'select',
790 'renderMode' => 'singlebox',
791 'renderType' => 'selectSingleBox'
792 ]
793 ],
794 'a-checkbox-column' => [
795 'config' => [
796 'type' => 'select',
797 'renderMode' => 'checkbox',
798 'renderType' => 'selectCheckBox'
799 ]
800 ],
801 'an-unknown-column' => [
802 'config' => [
803 'type' => 'select',
804 'renderMode' => 'unknown'
805 ]
806 ],
807 'a-maxitems-column-not-set' => [
808 'config' => [
809 'type' => 'select',
810 'renderType' => 'selectSingle'
811 ]
812 ],
813 'a-maxitems-column-0' => [
814 'config' => [
815 'type' => 'select',
816 'maxitems' => '0',
817 'renderType' => 'selectSingle'
818 ]
819 ],
820 'a-maxitems-column-1' => [
821 'config' => [
822 'type' => 'select',
823 'maxitems' => 1,
824 'renderType' => 'selectSingle'
825 ]
826 ],
827 'a-maxitems-column-2' => [
828 'config' => [
829 'type' => 'select',
830 'maxitems' => 2,
831 'renderType' => 'selectMultipleSideBySide'
832 ]
833 ],
834 'a-tree-column-with-maxitems' => [
835 'config' => [
836 'type' => 'select',
837 'renderMode' => 'tree',
838 'renderType' => 'selectTree',
839 'maxitems' => '1'
840 ]
841 ],
842 'a-singlebox-column-with-maxitems' => [
843 'config' => [
844 'type' => 'select',
845 'renderMode' => 'singlebox',
846 'renderType' => 'selectSingleBox',
847 'maxitems' => '1'
848 ]
849 ],
850 'a-checkbox-column-with-maxitems' => [
851 'config' => [
852 'type' => 'select',
853 'renderMode' => 'checkbox',
854 'renderType' => 'selectCheckBox',
855 'maxitems' => '1'
856 ]
857 ],
858 ],
859 ],
860 ];
861 $subject = new TcaMigration();
862 $this->assertEquals($expected, $subject->migrate($input));
863 }
864
865 /**
866 * @return array
867 */
868 public function migrateSetsShowIconTableIfMissingDataProvider()
869 {
870 return [
871 'not-a-select-is-kept' => [
872 [
873 // Given config section
874 'type' => 'input',
875 ],
876 [
877 // Expected config section
878 'type' => 'input',
879 ],
880 ],
881 'not-a-selectSingle-is-kept' => [
882 [
883 'type' => 'select',
884 'renderType' => 'selectCheckBox',
885 ],
886 [
887 'type' => 'select',
888 'renderType' => 'selectCheckBox',
889 ],
890 ],
891 'noIconsBelowSelect-true-is-removed' => [
892 [
893 'type' => 'select',
894 'renderType' => 'selectSingle',
895 'noIconsBelowSelect' => true,
896 ],
897 [
898 'type' => 'select',
899 'renderType' => 'selectSingle',
900 ],
901 ],
902 'noIconsBelowSelect-false-is-removed-sets-showIconTable' => [
903 [
904 'type' => 'select',
905 'renderType' => 'selectSingle',
906 'noIconsBelowSelect' => false,
907 ],
908 [
909 'type' => 'select',
910 'renderType' => 'selectSingle',
911 'showIconTable' => true,
912 ],
913 ],
914 'noIconsBelowSelect-false-is-removed-keeps-given-showIconTable' => [
915 [
916 'type' => 'select',
917 'renderType' => 'selectSingle',
918 'noIconsBelowSelect' => false,
919 'showIconTable' => false,
920 ],
921 [
922 'type' => 'select',
923 'renderType' => 'selectSingle',
924 'showIconTable' => false,
925 ],
926 ],
927 'suppress-icons-1-is-removed' => [
928 [
929 'type' => 'select',
930 'renderType' => 'selectSingle',
931 'suppress_icons' => '1',
932 ],
933 [
934 'type' => 'select',
935 'renderType' => 'selectSingle',
936 ],
937 ],
938 'suppress-icons-value-is-removed' => [
939 [
940 'type' => 'select',
941 'renderType' => 'selectSingle',
942 'suppress_icons' => 'IF_VALUE_FALSE',
943 ],
944 [
945 'type' => 'select',
946 'renderType' => 'selectSingle',
947 ],
948 ],
949 'selicon-cols-sets-showIconTable' => [
950 [
951 'type' => 'select',
952 'renderType' => 'selectSingle',
953 'selicon_cols' => 16,
954 ],
955 [
956 'type' => 'select',
957 'renderType' => 'selectSingle',
958 'selicon_cols' => 16,
959 'showIconTable' => true,
960 ],
961 ],
962 'selicon-cols-does-not-override-given-showIconTable' => [
963 [
964 'type' => 'select',
965 'renderType' => 'selectSingle',
966 'selicon_cols' => 16,
967 'showIconTable' => false,
968 ],
969 [
970 'type' => 'select',
971 'renderType' => 'selectSingle',
972 'selicon_cols' => 16,
973 'showIconTable' => false,
974 ],
975 ],
976 'foreign_table_loadIcons-is-removed' => [
977 [
978 'type' => 'select',
979 'renderType' => 'selectSingle',
980 'foreign_table_loadIcons' => true,
981 ],
982 [
983 'type' => 'select',
984 'renderType' => 'selectSingle',
985 ],
986 ],
987 ];
988 }
989
990 /**
991 * @test
992 * @dataProvider migrateSetsShowIconTableIfMissingDataProvider
993 * @param array $givenConfig
994 * @param array $expectedConfig
995 */
996 public function migrateSetsShowIconTableIfMissing(array $givenConfig, array $expectedConfig)
997 {
998 $input = [
999 'aTable' => [
1000 'columns' => [
1001 'aField' => [
1002 'config' => $givenConfig,
1003 ]
1004 ],
1005 ],
1006 ];
1007 $expected = $input;
1008 $expected['aTable']['columns']['aField']['config'] = $expectedConfig;
1009
1010 $subject = new TcaMigration();
1011 $this->assertEquals($expected, $subject->migrate($input));
1012 }
1013
1014 /**
1015 * @test
1016 */
1017 public function migrateFixesReferenceToLinkHandler()
1018 {
1019 $input = [
1020 'aTable' => [
1021 'columns' => [
1022 'aCol' => [
1023 'config' => [
1024 'type' => 'input',
1025 'wizards' => [
1026 'link' => [
1027 'module' => [
1028 'name' => 'wizard_element_browser',
1029 'urlParameters' => [
1030 'mode' => 'wizard'
1031 ]
1032 ],
1033 ],
1034 ],
1035 ],
1036 ],
1037 ],
1038 ],
1039 ];
1040 $expected = [
1041 'aTable' => [
1042 'columns' => [
1043 'aCol' => [
1044 'config' => [
1045 'type' => 'input',
1046 'wizards' => [
1047 'link' => [
1048 'module' => [
1049 'name' => 'wizard_link',
1050 ],
1051 ],
1052 ],
1053 ],
1054 ],
1055 ],
1056 ],
1057 ];
1058
1059 $subject = new TcaMigration();
1060 $this->assertEquals($expected, $subject->migrate($input));
1061 }
1062
1063 /**
1064 * @return array
1065 */
1066 public function migrateRemovesRteTransformOptionsDataProvider()
1067 {
1068 return [
1069 'remove empty options in columns' => [
1070 [
1071 // Given config section
1072 'aTable' => [
1073 'columns' => [
1074 'aField' => [
1075 'defaultExtras' => 'richtext:rte_transform[]'
1076 ]
1077 ]
1078 ]
1079 ],
1080 [
1081 // Expected config section
1082 'aTable' => [
1083 'columns' => [
1084 'aField' => [
1085 'defaultExtras' => 'richtext:rte_transform'
1086 ]
1087 ]
1088 ]
1089 ],
1090 ],
1091 'remove nothing in columns' => [
1092 [
1093 'aTable' => [
1094 'columns' => [
1095 'aField' => [
1096 'defaultExtras' => 'richtext:rte_transform'
1097 ]
1098 ]
1099 ]
1100 ],
1101 [
1102 'aTable' => [
1103 'columns' => [
1104 'aField' => [
1105 'defaultExtras' => 'richtext:rte_transform'
1106 ]
1107 ]
1108 ]
1109 ],
1110 ],
1111 'remove mode in columns' => [
1112 [
1113 'aTable' => [
1114 'columns' => [
1115 'aField' => [
1116 'defaultExtras' => 'richtext:rte_transform[mode=ts_css]'
1117 ]
1118 ]
1119 ]
1120 ],
1121 [
1122 'aTable' => [
1123 'columns' => [
1124 'aField' => [
1125 'defaultExtras' => 'richtext:rte_transform'
1126 ]
1127 ]
1128 ]
1129 ],
1130 ],
1131 'remove flag and mode in columns' => [
1132 [
1133 'aTable' => [
1134 'columns' => [
1135 'aField' => [
1136 'defaultExtras' => 'richtext:rte_transform[flag=rte_enabled|mode=ts_css]'
1137 ]
1138 ]
1139 ]
1140 ],
1141 [
1142 'aTable' => [
1143 'columns' => [
1144 'aField' => [
1145 'defaultExtras' => 'richtext:rte_transform'
1146 ]
1147 ]
1148 ]
1149 ],
1150 ],
1151 'remove flag and mode in columns with array notation' => [
1152 [
1153 'aTable' => [
1154 'columns' => [
1155 'aField' => [
1156 'defaultExtras' => 'richtext[]:rte_transform[flag=rte_enabled|mode=ts_css]'
1157 ]
1158 ]
1159 ]
1160 ],
1161 [
1162 'aTable' => [
1163 'columns' => [
1164 'aField' => [
1165 'defaultExtras' => 'richtext[]:rte_transform'
1166 ]
1167 ]
1168 ]
1169 ],
1170 ],
1171 'remove flag and mode in columns with array notation and index' => [
1172 [
1173 'aTable' => [
1174 'columns' => [
1175 'aField' => [
1176 'defaultExtras' => 'richtext[*]:rte_transform[flag=rte_enabled|mode=ts_css]'
1177 ]
1178 ]
1179 ]
1180 ],
1181 [
1182 'aTable' => [
1183 'columns' => [
1184 'aField' => [
1185 'defaultExtras' => 'richtext[*]:rte_transform'
1186 ]
1187 ]
1188 ]
1189 ],
1190 ],
1191 'remove flag and mode in columns with array notation and index and option list' => [
1192 [
1193 'aTable' => [
1194 'columns' => [
1195 'aField' => [
1196 'defaultExtras' => 'richtext[cut|copy|paste]:rte_transform[flag=rte_enabled|mode=ts_css]'
1197 ]
1198 ]
1199 ]
1200 ],
1201 [
1202 'aTable' => [
1203 'columns' => [
1204 'aField' => [
1205 'defaultExtras' => 'richtext[cut|copy|paste]:rte_transform'
1206 ]
1207 ]
1208 ]
1209 ],
1210 ],
1211 'remove empty options in columnsOverrides' => [
1212 [
1213 'aTable' => [
1214 'types' => [
1215 'aType' => [
1216 'columnsOverrides' => [
1217 'aField' => [
1218 'defaultExtras' => 'richtext:rte_transform[]'
1219 ]
1220 ]
1221 ]
1222 ]
1223 ]
1224 ],
1225 [
1226 'aTable' => [
1227 'types' => [
1228 'aType' => [
1229 'columnsOverrides' => [
1230 'aField' => [
1231 'defaultExtras' => 'richtext:rte_transform'
1232 ]
1233 ]
1234 ]
1235 ]
1236 ]
1237 ],
1238 ],
1239 'remove nothing in columnsOverrides' => [
1240 [
1241 'aTable' => [
1242 'types' => [
1243 'aType' => [
1244 'columnsOverrides' => [
1245 'aField' => [
1246 'defaultExtras' => 'richtext:rte_transform'
1247 ]
1248 ]
1249 ]
1250 ]
1251 ]
1252 ],
1253 [
1254 'aTable' => [
1255 'types' => [
1256 'aType' => [
1257 'columnsOverrides' => [
1258 'aField' => [
1259 'defaultExtras' => 'richtext:rte_transform'
1260 ]
1261 ]
1262 ]
1263 ]
1264 ]
1265 ],
1266 ],
1267 'remove mode in columnsOverrides' => [
1268 [
1269 'aTable' => [
1270 'types' => [
1271 'aType' => [
1272 'columnsOverrides' => [
1273 'aField' => [
1274 'defaultExtras' => 'richtext:rte_transform[mode=ts_css]'
1275 ]
1276 ]
1277 ]
1278 ]
1279 ]
1280 ],
1281 [
1282 'aTable' => [
1283 'types' => [
1284 'aType' => [
1285 'columnsOverrides' => [
1286 'aField' => [
1287 'defaultExtras' => 'richtext:rte_transform'
1288 ]
1289 ]
1290 ]
1291 ]
1292 ]
1293 ],
1294 ],
1295 'remove flag and mode in columnsOverrides' => [
1296 [
1297 'aTable' => [
1298 'types' => [
1299 'aType' => [
1300 'columnsOverrides' => [
1301 'aField' => [
1302 'defaultExtras' => 'richtext:rte_transform[flag=rte_enabled|mode=ts_css]'
1303 ]
1304 ]
1305 ]
1306 ]
1307 ]
1308 ],
1309 [
1310 'aTable' => [
1311 'types' => [
1312 'aType' => [
1313 'columnsOverrides' => [
1314 'aField' => [
1315 'defaultExtras' => 'richtext:rte_transform'
1316 ]
1317 ]
1318 ]
1319 ]
1320 ]
1321 ],
1322 ],
1323 'remove flag and mode in columnsOverrides with array notation' => [
1324 [
1325 'aTable' => [
1326 'types' => [
1327 'aType' => [
1328 'columnsOverrides' => [
1329 'aField' => [
1330 'defaultExtras' => 'richtext[]:rte_transform[flag=rte_enabled|mode=ts_css]'
1331 ]
1332 ]
1333 ]
1334 ]
1335 ]
1336 ],
1337 [
1338 'aTable' => [
1339 'types' => [
1340 'aType' => [
1341 'columnsOverrides' => [
1342 'aField' => [
1343 'defaultExtras' => 'richtext[]:rte_transform'
1344 ]
1345 ]
1346 ]
1347 ]
1348 ]
1349 ],
1350 ],
1351 'remove flag and mode in columnsOverrides with array notation and index' => [
1352 [
1353 'aTable' => [
1354 'types' => [
1355 'aType' => [
1356 'columnsOverrides' => [
1357 'aField' => [
1358 'defaultExtras' => 'richtext[*]:rte_transform[flag=rte_enabled|mode=ts_css]'
1359 ]
1360 ]
1361 ]
1362 ]
1363 ]
1364 ],
1365 [
1366 'aTable' => [
1367 'types' => [
1368 'aType' => [
1369 'columnsOverrides' => [
1370 'aField' => [
1371 'defaultExtras' => 'richtext[*]:rte_transform'
1372 ]
1373 ]
1374 ]
1375 ]
1376 ]
1377 ],
1378 ],
1379 'remove flag and mode in columnsOverrides with array notation and index and option list' => [
1380 [
1381 'aTable' => [
1382 'types' => [
1383 'aType' => [
1384 'columnsOverrides' => [
1385 'aField' => [
1386 'defaultExtras' => 'richtext[copy|cut|paste]:rte_transform[flag=rte_enabled|mode=ts_css]'
1387 ]
1388 ]
1389 ]
1390 ]
1391 ]
1392 ],
1393 [
1394 'aTable' => [
1395 'types' => [
1396 'aType' => [
1397 'columnsOverrides' => [
1398 'aField' => [
1399 'defaultExtras' => 'richtext[copy|cut|paste]:rte_transform'
1400 ]
1401 ]
1402 ]
1403 ]
1404 ]
1405 ],
1406 ],
1407 ];
1408 }
1409
1410 /**
1411 * @test
1412 * @dataProvider migrateRemovesRteTransformOptionsDataProvider
1413 * @param array $givenConfig
1414 * @param array $expectedConfig
1415 */
1416 public function migrateRemovesRteTransformOptions(array $givenConfig, array $expectedConfig)
1417 {
1418 $subject = new TcaMigration();
1419 $this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
1420 }
1421
1422 /**
1423 * @test
1424 */
1425 public function migrateRewritesColorpickerWizard()
1426 {
1427 $input = [
1428 'aTable' => [
1429 'columns' => [
1430 'aCol' => [
1431 'config' => [
1432 'type' => 'input',
1433 'wizards' => [
1434 'colorpicker' => [
1435 'type' => 'colorbox',
1436 'title' => 'Color picker',
1437 'module' => [
1438 'name' => 'wizard_colorpicker',
1439 ],
1440 'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
1441 ],
1442 ],
1443 ],
1444 ],
1445 ],
1446 ],
1447 ];
1448 $expected = [
1449 'aTable' => [
1450 'columns' => [
1451 'aCol' => [
1452 'config' => [
1453 'type' => 'input',
1454 'renderType' => 'colorpicker',
1455 ],
1456 ],
1457 ],
1458 ],
1459 ];
1460
1461 $subject = new TcaMigration();
1462 $this->assertEquals($expected, $subject->migrate($input));
1463 }
1464
1465 /**
1466 * @return array
1467 */
1468 public function migrateSelectTreeOptionsDataProvider()
1469 {
1470 return [
1471 'remove width' => [
1472 [
1473 // Given config section
1474 'aTable' => [
1475 'columns' => [
1476 'aField' => [
1477 'config' => [
1478 'type' => 'select',
1479 'renderType' => 'selectTree',
1480 'treeConfig' => [
1481 'appearance' => [
1482 'width' => 200
1483 ]
1484 ]
1485 ]
1486 ]
1487 ]
1488 ]
1489 ],
1490 [
1491 // Expected config section
1492 'aTable' => [
1493 'columns' => [
1494 'aField' => [
1495 'config' => [
1496 'type' => 'select',
1497 'renderType' => 'selectTree',
1498 'treeConfig' => [
1499 'appearance' => [
1500 ]
1501 ]
1502 ]
1503 ]
1504 ]
1505 ]
1506 ]
1507 ],
1508 'remove allowRecursiveMode' => [
1509 [
1510 // Given config section
1511 'aTable' => [
1512 'columns' => [
1513 'aField' => [
1514 'config' => [
1515 'type' => 'select',
1516 'renderType' => 'selectTree',
1517 'treeConfig' => [
1518 'appearance' => [
1519 'someKey' => 'value',
1520 'allowRecursiveMode' => true
1521 ]
1522 ]
1523 ]
1524 ]
1525 ]
1526 ]
1527 ],
1528 [
1529 // Expected config section
1530 'aTable' => [
1531 'columns' => [
1532 'aField' => [
1533 'config' => [
1534 'type' => 'select',
1535 'renderType' => 'selectTree',
1536 'treeConfig' => [
1537 'appearance' => [
1538 'someKey' => 'value'
1539 ]
1540 ]
1541 ]
1542 ]
1543 ]
1544 ]
1545 ]
1546 ],
1547 'move autoSizeMax to size' => [
1548 [
1549 // Given config section
1550 'aTable' => [
1551 'columns' => [
1552 'aField' => [
1553 'config' => [
1554 'type' => 'select',
1555 'renderType' => 'selectTree',
1556 'autoSizeMax' => 20,
1557 'size' => 10
1558 ]
1559 ]
1560 ]
1561 ]
1562 ],
1563 [
1564 // Expected config section
1565 'aTable' => [
1566 'columns' => [
1567 'aField' => [
1568 'config' => [
1569 'type' => 'select',
1570 'renderType' => 'selectTree',
1571 'size' => 20
1572 ]
1573 ]
1574 ]
1575 ]
1576 ]
1577 ],
1578 'keep settings for non selectTree' => [
1579 [
1580 // Given config section
1581 'aTable' => [
1582 'columns' => [
1583 'aField' => [
1584 'config' => [
1585 'type' => 'select',
1586 'renderType' => 'not a select tree',
1587 'autoSizeMax' => 20,
1588 'size' => 10,
1589 'treeConfig' => [
1590 'appearance' => [
1591 'someKey' => 'value',
1592 'allowRecursiveMode' => true,
1593 'width' => 200
1594 ]
1595 ]
1596 ]
1597 ]
1598 ]
1599 ]
1600 ],
1601 [
1602 // Expected config section
1603 'aTable' => [
1604 'columns' => [
1605 'aField' => [
1606 'config' => [
1607 'type' => 'select',
1608 'renderType' => 'not a select tree',
1609 'autoSizeMax' => 20,
1610 'size' => 10,
1611 'treeConfig' => [
1612 'appearance' => [
1613 'someKey' => 'value',
1614 'allowRecursiveMode' => true,
1615 'width' => 200
1616 ]
1617 ]
1618 ]
1619 ]
1620 ]
1621 ]
1622 ]
1623 ]
1624 ];
1625 }
1626
1627 /**
1628 * @test
1629 * @dataProvider migrateSelectTreeOptionsDataProvider
1630 * @param array $input
1631 * @param array $expected
1632 */
1633 public function migrateSelectTreeOptions(array $input, array $expected)
1634 {
1635 $subject = new TcaMigration();
1636 $this->assertEquals($expected, $subject->migrate($input));
1637 }
1638
1639 public function migrateTsTemplateSoftReferencesDataProvider()
1640 {
1641 return [
1642 'nothing removed' => [
1643 [
1644 'aTable' => [
1645 'columns' => [
1646 'aCol' => [
1647 'config' => [
1648 'type' => 'input',
1649 'softref' => 'email,somethingelse'
1650 ],
1651 ],
1652 ],
1653 ],
1654 ],
1655 [
1656 'aTable' => [
1657 'columns' => [
1658 'aCol' => [
1659 'config' => [
1660 'type' => 'input',
1661 'softref' => 'email,somethingelse',
1662 ],
1663 ],
1664 ],
1665 ],
1666 ]
1667 ],
1668 'TStemplate only' => [
1669 [
1670 'aTable' => [
1671 'columns' => [
1672 'aCol' => [
1673 'config' => [
1674 'type' => 'input',
1675 'softref' => 'TStemplate,somethingelse'
1676 ],
1677 ],
1678 ],
1679 ],
1680 ],
1681 [
1682 'aTable' => [
1683 'columns' => [
1684 'aCol' => [
1685 'config' => [
1686 'type' => 'input',
1687 'softref' => 'somethingelse',
1688 ],
1689 ],
1690 ],
1691 ],
1692 ]
1693 ],
1694 'TStemplate and TSconfig' => [
1695 [
1696 'aTable' => [
1697 'columns' => [
1698 'aCol' => [
1699 'config' => [
1700 'type' => 'input',
1701 'softref' => 'TStemplate,somethingelse,TSconfig'
1702 ],
1703 ],
1704 ],
1705 ],
1706 ],
1707 [
1708 'aTable' => [
1709 'columns' => [
1710 'aCol' => [
1711 'config' => [
1712 'type' => 'input',
1713 'softref' => 'somethingelse',
1714 ],
1715 ],
1716 ],
1717 ],
1718 ]
1719 ],
1720 ];
1721 }
1722
1723 /**
1724 * @test
1725 * @dataProvider migrateTsTemplateSoftReferencesDataProvider
1726 * @param array $givenConfig
1727 * @param array $expectedConfig
1728 */
1729 public function migrateTsTemplateSoftReferences(array $givenConfig, array $expectedConfig)
1730 {
1731 $subject = new TcaMigration();
1732 $this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
1733 }
1734
1735 public function migrateShowIfRTESettingDataProvider()
1736 {
1737 return [
1738 'nothing removed' => [
1739 [
1740 'aTable' => [
1741 'columns' => [
1742 'aCol' => [
1743 'config' => [
1744 'type' => 'check'
1745 ],
1746 ],
1747 ],
1748 ],
1749 ],
1750 [
1751 'aTable' => [
1752 'columns' => [
1753 'aCol' => [
1754 'config' => [
1755 'type' => 'check'
1756 ],
1757 ],
1758 ],
1759 ],
1760 ]
1761 ],
1762 'Option removed' => [
1763 [
1764 'aTable' => [
1765 'columns' => [
1766 'aCol' => [
1767 'config' => [
1768 'type' => 'check',
1769 'showIfRTE' => false
1770 ],
1771 ],
1772 ],
1773 ],
1774 ],
1775 [
1776 'aTable' => [
1777 'columns' => [
1778 'aCol' => [
1779 'config' => [
1780 'type' => 'check'
1781 ],
1782 ],
1783 ],
1784 ],
1785 ]
1786
1787 ],
1788 ];
1789 }
1790
1791 /**
1792 * @test
1793 * @dataProvider migrateShowIfRTESettingDataProvider
1794 * @param array $givenConfig
1795 * @param array $expectedConfig
1796 */
1797 public function migrateShowIfRTESetting(array $givenConfig, array $expectedConfig)
1798 {
1799 $subject = new TcaMigration();
1800 $this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
1801 }
1802
1803 public function migrateWorkspaceSettingsDataProvider()
1804 {
1805 return [
1806 'no workspaces enabled' => [
1807 [
1808 'aTable' => [
1809 'ctrl' => [
1810 'versioningWS' => false
1811 ],
1812 ],
1813 ],
1814 [
1815 'aTable' => [
1816 'ctrl' => [
1817 'versioningWS' => false
1818 ],
1819 ],
1820 ]
1821 ],
1822 'nothing activated' => [
1823 [
1824 'aTable' => [
1825 'ctrl' => [
1826 'label' => 'blabla'
1827 ],
1828 ],
1829 ],
1830 [
1831 'aTable' => [
1832 'ctrl' => [
1833 'label' => 'blabla'
1834 ],
1835 ],
1836 ]
1837 ],
1838 'nothing changed, workspaces enabled' => [
1839 [
1840 'aTable' => [
1841 'ctrl' => [
1842 'versioningWS' => true
1843 ],
1844 ],
1845 ],
1846 [
1847 'aTable' => [
1848 'ctrl' => [
1849 'versioningWS' => true
1850 ],
1851 ],
1852 ]
1853 ],
1854 'cast workspaces to bool' => [
1855 [
1856 'aTable' => [
1857 'ctrl' => [
1858 'versioningWS' => 1
1859 ],
1860 ],
1861 ],
1862 [
1863 'aTable' => [
1864 'ctrl' => [
1865 'versioningWS' => true
1866 ],
1867 ],
1868 ]
1869 ],
1870 'cast workspaces v2 to bool' => [
1871 [
1872 'aTable' => [
1873 'ctrl' => [
1874 'versioningWS' => 2
1875 ],
1876 ],
1877 ],
1878 [
1879 'aTable' => [
1880 'ctrl' => [
1881 'versioningWS' => true
1882 ],
1883 ],
1884 ]
1885 ],
1886 'cast workspaces v2 to bool and remove followpages' => [
1887 [
1888 'aTable' => [
1889 'ctrl' => [
1890 'versioningWS' => 2,
1891 'versioning_followPages' => true
1892 ],
1893 ],
1894 ],
1895 [
1896 'aTable' => [
1897 'ctrl' => [
1898 'versioningWS' => true
1899 ],
1900 ],
1901 ]
1902 ],
1903 ];
1904 }
1905
1906 /**
1907 * @test
1908 * @dataProvider migrateWorkspaceSettingsDataProvider
1909 * @param array $givenConfig
1910 * @param array $expectedConfig
1911 */
1912 public function migrateWorkspaceSettings(array $givenConfig, array $expectedConfig)
1913 {
1914 $subject = new TcaMigration();
1915 $this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
1916 }
1917
1918 /**
1919 * @return array
1920 */
1921 public function migrateTranslationTableDataProvider()
1922 {
1923 return [
1924 'remove transForeignTable' => [
1925 [
1926 'aTable' => [
1927 'ctrl' => [
1928 'transForeignTable' => 'pages_language_overlay',
1929 ],
1930 ],
1931 ],
1932 [
1933 'aTable' => [
1934 'ctrl' => [],
1935 ],
1936 ]
1937 ],
1938 'remove transOrigPointerTable' => [
1939 [
1940 'aTable' => [
1941 'ctrl' => [
1942 'transOrigPointerTable' => 'pages',
1943 ],
1944 ],
1945 ],
1946 [
1947 'aTable' => [
1948 'ctrl' => [],
1949 ],
1950 ]
1951 ]
1952 ];
1953 }
1954
1955 /**
1956 * @param array $givenConfig
1957 * @param array $expectedConfig
1958 * @test
1959 * @dataProvider migrateTranslationTableDataProvider
1960 */
1961 public function migrateTranslationTable(array $givenConfig, array $expectedConfig)
1962 {
1963 $subject = new TcaMigration();
1964 $this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
1965 }
1966
1967 /**
1968 * @return array
1969 */
1970 public function migrateMovesRequestUpdateCtrlFieldToColumnsDataProvider()
1971 {
1972 return [
1973 'move single field name' => [
1974 [
1975 'aTable' => [
1976 'ctrl' => [
1977 'requestUpdate' => 'aField',
1978 ],
1979 'columns' => [
1980 'aField' => [
1981 'label' => 'foo',
1982 'config' => [
1983 'type' => 'input',
1984 ],
1985 ],
1986 ],
1987 ],
1988 ],
1989 [
1990 'aTable' => [
1991 'ctrl' => [],
1992 'columns' => [
1993 'aField' => [
1994 'label' => 'foo',
1995 'config' => [
1996 'type' => 'input',
1997 ],
1998 'onChange' => 'reload',
1999 ],
2000 ],
2001 ],
2002 ],
2003 ],
2004 'ignore missing field but migrate others' => [
2005 [
2006 'aTable' => [
2007 'ctrl' => [
2008 'requestUpdate' => 'aField, bField, cField, ',
2009 ],
2010 'columns' => [
2011 'aField' => [],
2012 'cField' => [],
2013 ],
2014 ],
2015 ],
2016 [
2017 'aTable' => [
2018 'ctrl' => [],
2019 'columns' => [
2020 'aField' => [
2021 'onChange' => 'reload',
2022 ],
2023 'cField' => [
2024 'onChange' => 'reload',
2025 ],
2026 ],
2027 ],
2028 ],
2029 ],
2030 ];
2031 }
2032
2033 /**
2034 * @param array $input
2035 * @param array $expected
2036 * @test
2037 * @dataProvider migrateMovesRequestUpdateCtrlFieldToColumnsDataProvider
2038 */
2039 public function migrateMovesRequestUpdateCtrlFieldToColumns(array $input, array $expected)
2040 {
2041 $this->assertEquals($expected, (new TcaMigration())->migrate($input));
2042 }
2043 }