[!!!][TASK] Improve flex and TCA handling in FormEngine
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Tests / Unit / Form / FormDataProvider / TcaInlineConfigurationTest.php
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
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\Backend\Form\FormDataProvider\TcaInlineConfiguration;
18
19 /**
20 * Test case
21 */
22 class TcaInlineConfigurationTest extends \TYPO3\CMS\Components\TestingFramework\Core\UnitTestCase
23 {
24 /**
25 * @var TcaInlineConfiguration
26 */
27 protected $subject;
28
29 protected function setUp()
30 {
31 $this->subject = new TcaInlineConfiguration();
32 }
33
34 /**
35 * @var array Set of default controls
36 */
37 protected $defaultConfig = [
38 'type' => 'inline',
39 'foreign_table' => 'aForeignTableName',
40 'minitems' => 0,
41 'maxitems' => 99999,
42 'behaviour' => [
43 'localizationMode' => 'none',
44 ],
45 'appearance' => [
46 'levelLinksPosition' => 'top',
47 'showPossibleLocalizationRecords' => false,
48 'showRemovedLocalizationRecords' => false,
49 'enabledControls' => [
50 'info' => true,
51 'new' => true,
52 'dragdrop' => true,
53 'sort' => true,
54 'hide' => true,
55 'delete' => true,
56 'localize' => true,
57 ],
58 ],
59 ];
60
61 /**
62 * @test
63 */
64 public function addDataThrowsExceptionForInlineFieldWithoutForeignTableConfig()
65 {
66 $input = [
67 'databaseRow' => [],
68 'processedTca' => [
69 'columns' => [
70 'aField' => [
71 'config' => [
72 'type' => 'inline',
73 ],
74 ],
75 ],
76 ],
77 ];
78 $this->expectException(\UnexpectedValueException::class);
79 $this->expectExceptionCode(1443793404);
80 $this->subject->addData($input);
81 }
82
83 /**
84 * @test
85 */
86 public function addDataSetsDefaults()
87 {
88 $input = [
89 'processedTca' => [
90 'columns' => [
91 'aField' => [
92 'config' => [
93 'type' => 'inline',
94 'foreign_table' => 'aForeignTableName',
95 ],
96 ],
97 ],
98 ],
99 ];
100 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
101 $this->assertEquals($expected, $this->subject->addData($input));
102 }
103
104 /**
105 * @test
106 */
107 public function addDataKeepsGivenMinitems()
108 {
109 $input = [
110 'processedTca' => [
111 'columns' => [
112 'aField' => [
113 'config' => [
114 'type' => 'inline',
115 'foreign_table' => 'aForeignTableName',
116 'minitems' => 23,
117 ],
118 ],
119 ],
120 ],
121 ];
122 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
123 $expected['processedTca']['columns']['aField']['config']['minitems'] = 23;
124 $this->assertEquals($expected, $this->subject->addData($input));
125 }
126
127 /**
128 * @test
129 */
130 public function addDataForcesMinitemsPositive()
131 {
132 $input = [
133 'processedTca' => [
134 'columns' => [
135 'aField' => [
136 'config' => [
137 'type' => 'inline',
138 'foreign_table' => 'aForeignTableName',
139 'minitems' => -23,
140 ],
141 ],
142 ],
143 ],
144 ];
145 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
146 $expected['processedTca']['columns']['aField']['config']['minitems'] = 0;
147 $this->assertEquals($expected, $this->subject->addData($input));
148 }
149
150 /**
151 * @test
152 */
153 public function addDataKeepsGivenMaxitems()
154 {
155 $input = [
156 'processedTca' => [
157 'columns' => [
158 'aField' => [
159 'config' => [
160 'type' => 'inline',
161 'foreign_table' => 'aForeignTableName',
162 'maxitems' => 23,
163 ],
164 ],
165 ],
166 ],
167 ];
168 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
169 $expected['processedTca']['columns']['aField']['config']['maxitems'] = 23;
170 $this->assertEquals($expected, $this->subject->addData($input));
171 }
172
173 /**
174 * @test
175 */
176 public function addDataForcesMaxitemsPositive()
177 {
178 $input = [
179 'processedTca' => [
180 'columns' => [
181 'aField' => [
182 'config' => [
183 'type' => 'inline',
184 'foreign_table' => 'aForeignTableName',
185 'maxitems' => '-23',
186 ],
187 ],
188 ],
189 ],
190 ];
191 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
192 $expected['processedTca']['columns']['aField']['config']['maxitems'] = 1;
193 $this->assertEquals($expected, $this->subject->addData($input));
194 }
195
196 /**
197 * @test
198 */
199 public function addDataThrowsExceptionIfLocalizationModeIsSetButNotToKeepOrSelect()
200 {
201 $input = [
202 'defaultLanguageRow' => [],
203 'processedTca' => [
204 'columns' => [
205 'aField' => [
206 'config' => [
207 'type' => 'inline',
208 'foreign_table' => 'aForeignTableName',
209 'behaviour' => [
210 'localizationMode' => 'foo',
211 ]
212 ],
213 ],
214 ],
215 ],
216 ];
217 $this->expectException(\UnexpectedValueException::class);
218 $this->expectExceptionCode(1443829370);
219 $this->subject->addData($input);
220 }
221
222 /**
223 * @test
224 */
225 public function addDataThrowsExceptionIfLocalizationModeIsSetToSelectAndChildIsNotLocalizable()
226 {
227 $input = [
228 'defaultLanguageRow' => [],
229 'processedTca' => [
230 'columns' => [
231 'aField' => [
232 'config' => [
233 'type' => 'inline',
234 'foreign_table' => 'aForeignTableName',
235 'behaviour' => [
236 'localizationMode' => 'select',
237 ]
238 ],
239 ],
240 ],
241 ],
242 ];
243 // not $globals definition for child here -> not localizable
244 $this->expectException(\UnexpectedValueException::class);
245 $this->expectExceptionCode(1443944274);
246 $this->subject->addData($input);
247 }
248
249 /**
250 * @test
251 */
252 public function addDataKeepsLocalizationModeSelectIfChildIsLocalizable()
253 {
254 $input = [
255 'defaultLanguageRow' => [],
256 'processedTca' => [
257 'columns' => [
258 'aField' => [
259 'config' => [
260 'type' => 'inline',
261 'foreign_table' => 'aForeignTableName',
262 'behaviour' => [
263 'localizationMode' => 'select',
264 ]
265 ],
266 ],
267 ],
268 ],
269 ];
270 $GLOBALS['TCA']['aForeignTableName']['ctrl'] = [
271 'languageField' => 'theLanguageField',
272 'transOrigPointerField' => 'theTransOrigPointerField',
273 ];
274 $expected = $input;
275 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
276 $expected['processedTca']['columns']['aField']['config']['behaviour']['localizationMode'] = 'select';
277 $this->assertEquals($expected, $this->subject->addData($input));
278 }
279
280 /**
281 * @test
282 */
283 public function addDataKeepsLocalizationModeKeep()
284 {
285 $input = [
286 'defaultLanguageRow' => [],
287 'processedTca' => [
288 'columns' => [
289 'aField' => [
290 'config' => [
291 'type' => 'inline',
292 'foreign_table' => 'aForeignTableName',
293 'behaviour' => [
294 'localizationMode' => 'keep',
295 ]
296 ],
297 ],
298 ],
299 ],
300 ];
301 $expected = $input;
302 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
303 $expected['processedTca']['columns']['aField']['config']['behaviour']['localizationMode'] = 'keep';
304 $this->assertEquals($expected, $this->subject->addData($input));
305 }
306
307 /**
308 * @test
309 */
310 public function addDataSetsLocalizationModeToNoneIfNotSetAndChildIsNotLocalizable()
311 {
312 $input = [
313 'defaultLanguageRow' => [],
314 'processedTca' => [
315 'columns' => [
316 'aField' => [
317 'config' => [
318 'type' => 'inline',
319 'foreign_table' => 'aForeignTableName',
320 ],
321 ],
322 ],
323 ],
324 ];
325 $expected = $input;
326 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
327 $expected['processedTca']['columns']['aField']['config']['behaviour']['localizationMode'] = 'none';
328 $this->assertEquals($expected, $this->subject->addData($input));
329 }
330
331 /**
332 * @test
333 */
334 public function addDataSetsLocalizationModeToSelectIfNotSetAndChildIsLocalizable()
335 {
336 $input = [
337 'defaultLanguageRow' => [],
338 'processedTca' => [
339 'columns' => [
340 'aField' => [
341 'config' => [
342 'type' => 'inline',
343 'foreign_table' => 'aForeignTableName',
344 ],
345 ],
346 ],
347 ],
348 ];
349 $GLOBALS['TCA']['aForeignTableName']['ctrl'] = [
350 'languageField' => 'theLanguageField',
351 'transOrigPointerField' => 'theTransOrigPointerField',
352 ];
353 $expected = $input;
354 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
355 $expected['processedTca']['columns']['aField']['config']['behaviour']['localizationMode'] = 'select';
356 $this->assertEquals($expected, $this->subject->addData($input));
357 }
358
359 /**
360 * @test
361 */
362 public function addDataMergesWithGivenAppearanceSettings()
363 {
364 $input = [
365 'processedTca' => [
366 'columns' => [
367 'aField' => [
368 'config' => [
369 'type' => 'inline',
370 'foreign_table' => 'aForeignTableName',
371 'appearance' => [
372 'levelLinksPosition' => 'both',
373 'enabledControls' => [
374 'dragdrop' => false,
375 ],
376 ],
377 ],
378 ],
379 ],
380 ],
381 ];
382 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
383 $expected['processedTca']['columns']['aField']['config']['appearance']['levelLinksPosition'] = 'both';
384 $expected['processedTca']['columns']['aField']['config']['appearance']['enabledControls']['dragdrop'] = false;
385 $this->assertEquals($expected, $this->subject->addData($input));
386 }
387
388 /**
389 * @test
390 */
391 public function addDataForcesLevelLinksPositionWithForeignSelector()
392 {
393 $input = [
394 'processedTca' => [
395 'columns' => [
396 'aField' => [
397 'config' => [
398 'type' => 'inline',
399 'foreign_table' => 'aForeignTableName',
400 'foreign_selector' => 'aField',
401 'appearance' => [
402 'levelLinksPosition' => 'both',
403 ],
404 ],
405 ],
406 ],
407 ],
408 ];
409 $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
410 'type' => 'select',
411 'foreign_table' => 'anotherForeignTableName',
412 ];
413 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
414 $expected['processedTca']['columns']['aField']['config']['foreign_selector'] = 'aField';
415 $expected['processedTca']['columns']['aField']['config']['selectorOrUniqueConfiguration'] = [
416 'fieldName' => 'aField',
417 'isSelector' => true,
418 'isUnique' => false,
419 'config' => [
420 'type' => 'select',
421 'foreign_table' => 'anotherForeignTableName',
422 ],
423 'foreignTable' => 'anotherForeignTableName',
424 ];
425 $expected['processedTca']['columns']['aField']['config']['appearance']['levelLinksPosition'] = 'none';
426 $this->assertEquals($expected, $this->subject->addData($input));
427 }
428
429 /**
430 * @test
431 */
432 public function addDataKeepsLevelLinksPositionWithForeignSelectorAndUseCombination()
433 {
434 $input = [
435 'processedTca' => [
436 'columns' => [
437 'aField' => [
438 'config' => [
439 'type' => 'inline',
440 'foreign_table' => 'aForeignTableName',
441 'foreign_selector' => 'aField',
442 'appearance' => [
443 'useCombination' => true,
444 'levelLinksPosition' => 'both',
445 ],
446 ],
447 ],
448 ],
449 ],
450 ];
451 $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
452 'type' => 'select',
453 'foreign_table' => 'anotherForeignTableName',
454 ];
455 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
456 $expected['processedTca']['columns']['aField']['config']['foreign_selector'] = 'aField';
457 $expected['processedTca']['columns']['aField']['config']['selectorOrUniqueConfiguration'] = [
458 'fieldName' => 'aField',
459 'isSelector' => true,
460 'isUnique' => false,
461 'config' => [
462 'type' => 'select',
463 'foreign_table' => 'anotherForeignTableName',
464 ],
465 'foreignTable' => 'anotherForeignTableName',
466 ];
467 $expected['processedTca']['columns']['aField']['config']['appearance']['useCombination'] = true;
468 $expected['processedTca']['columns']['aField']['config']['appearance']['levelLinksPosition'] = 'both';
469 $this->assertEquals($expected, $this->subject->addData($input));
470 }
471
472 /**
473 * @test
474 */
475 public function addDataKeepsShowPossibleLocalizationRecordsButForcesBooleanTrue()
476 {
477 $input = [
478 'processedTca' => [
479 'columns' => [
480 'aField' => [
481 'config' => [
482 'type' => 'inline',
483 'foreign_table' => 'aForeignTableName',
484 'appearance' => [
485 'showPossibleLocalizationRecords' => '1',
486 ],
487 ],
488 ],
489 ],
490 ],
491 ];
492 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
493 $expected['processedTca']['columns']['aField']['config']['appearance']['showPossibleLocalizationRecords'] = true;
494 $this->assertEquals($expected, $this->subject->addData($input));
495 }
496
497 /**
498 * @test
499 */
500 public function addDataKeepsShowPossibleLocalizationRecordsButForcesBooleanFalse()
501 {
502 $input = [
503 'processedTca' => [
504 'columns' => [
505 'aField' => [
506 'config' => [
507 'type' => 'inline',
508 'foreign_table' => 'aForeignTableName',
509 'appearance' => [
510 'showPossibleLocalizationRecords' => 0,
511 ],
512 ],
513 ],
514 ],
515 ],
516 ];
517 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
518 $expected['processedTca']['columns']['aField']['config']['appearance']['showPossibleLocalizationRecords'] = false;
519 $this->assertEquals($expected, $this->subject->addData($input));
520 }
521
522 /**
523 * @test
524 */
525 public function addDataKeepshowRemovedLocalizationRecordsButForcesBooleanTrue()
526 {
527 $input = [
528 'processedTca' => [
529 'columns' => [
530 'aField' => [
531 'config' => [
532 'type' => 'inline',
533 'foreign_table' => 'aForeignTableName',
534 'appearance' => [
535 'showRemovedLocalizationRecords' => 1,
536 ],
537 ],
538 ],
539 ],
540 ],
541 ];
542 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
543 $expected['processedTca']['columns']['aField']['config']['appearance']['showRemovedLocalizationRecords'] = true;
544 $this->assertEquals($expected, $this->subject->addData($input));
545 }
546
547 /**
548 * @test
549 */
550 public function addDataKeepsShowRemovedLocalizationRecordsButForcesBooleanFalse()
551 {
552 $input = [
553 'processedTca' => [
554 'columns' => [
555 'aField' => [
556 'config' => [
557 'type' => 'inline',
558 'foreign_table' => 'aForeignTableName',
559 'appearance' => [
560 'showRemovedLocalizationRecords' => '',
561 ],
562 ],
563 ],
564 ],
565 ],
566 ];
567 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
568 $expected['processedTca']['columns']['aField']['config']['appearance']['showRemovedLocalizationRecords'] = false;
569 $this->assertEquals($expected, $this->subject->addData($input));
570 }
571
572 /**
573 * @test
574 */
575 public function addDataThrowsExceptionIfForeignSelectorAndForeignUniquePointToDifferentFields()
576 {
577 $input = [
578 'processedTca' => [
579 'columns' => [
580 'aField' => [
581 'config' => [
582 'type' => 'inline',
583 'foreign_table' => 'aForeignTableName',
584 'foreign_selector' => 'aField',
585 'foreign_unique' => 'aDifferentField',
586 ],
587 ],
588 ],
589 ],
590 ];
591 $this->expectException(\UnexpectedValueException::class);
592 $this->expectExceptionCode(1444995464);
593 $this->subject->addData($input);
594 }
595
596 /**
597 * @test
598 */
599 public function addDataThrowsExceptionIfForeignSelectorPointsToANotExistingField()
600 {
601 $input = [
602 'processedTca' => [
603 'columns' => [
604 'aField' => [
605 'config' => [
606 'type' => 'inline',
607 'foreign_table' => 'aForeignTableName',
608 'foreign_selector' => 'aField',
609 ],
610 ],
611 ],
612 ],
613 ];
614 $this->expectException(\UnexpectedValueException::class);
615 $this->expectExceptionCode(1444996537);
616 $this->subject->addData($input);
617 }
618
619 /**
620 * @test
621 */
622 public function addDataThrowsExceptionIfForeignUniquePointsToANotExistingField()
623 {
624 $input = [
625 'processedTca' => [
626 'columns' => [
627 'aField' => [
628 'config' => [
629 'type' => 'inline',
630 'foreign_table' => 'aForeignTableName',
631 'foreign_unique' => 'aField',
632 ],
633 ],
634 ],
635 ],
636 ];
637 $this->expectException(\UnexpectedValueException::class);
638 $this->expectExceptionCode(1444996537);
639 $this->subject->addData($input);
640 }
641
642 /**
643 * @test
644 */
645 public function addDataThrowsExceptionIfForeignUniqueTargetIsNotTypeSelectOrGroup()
646 {
647 $input = [
648 'processedTca' => [
649 'columns' => [
650 'aField' => [
651 'config' => [
652 'type' => 'inline',
653 'foreign_table' => 'aForeignTableName',
654 'foreign_unique' => 'aField',
655 ],
656 ],
657 ],
658 ],
659 ];
660 $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
661 'type' => 'notSelectOrGroup',
662 ];
663 $this->expectException(\UnexpectedValueException::class);
664 $this->expectExceptionCode(1444996537);
665 $this->subject->addData($input);
666 }
667
668 /**
669 * @test
670 */
671 public function addDataThrowsExceptionForForeignSelectorGroupWithoutInternalTypeDb()
672 {
673 $input = [
674 'processedTca' => [
675 'columns' => [
676 'aField' => [
677 'config' => [
678 'type' => 'inline',
679 'foreign_table' => 'aForeignTableName',
680 'foreign_unique' => 'aField',
681 ],
682 ],
683 ],
684 ],
685 ];
686 $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
687 'type' => 'group',
688 'internal_type' => 'notDb'
689 ];
690 $this->expectException(\UnexpectedValueException::class);
691 $this->expectExceptionCode(1444999130);
692 $this->subject->addData($input);
693 }
694
695 /**
696 * @test
697 */
698 public function addDataThrowsExceptionIfForeignUniqueSelectDoesNotDefineForeignTable()
699 {
700 $input = [
701 'processedTca' => [
702 'columns' => [
703 'aField' => [
704 'config' => [
705 'type' => 'inline',
706 'foreign_table' => 'aForeignTableName',
707 'foreign_unique' => 'aField',
708 ],
709 ],
710 ],
711 ],
712 ];
713 $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
714 'type' => 'select',
715 ];
716 $this->expectException(\UnexpectedValueException::class);
717 $this->expectExceptionCode(1445078627);
718 $this->subject->addData($input);
719 }
720
721 /**
722 * @test
723 */
724 public function addDataThrowsExceptionIfForeignUniqueGroupDoesNotDefineForeignTable()
725 {
726 $input = [
727 'processedTca' => [
728 'columns' => [
729 'aField' => [
730 'config' => [
731 'type' => 'inline',
732 'foreign_table' => 'aForeignTableName',
733 'foreign_unique' => 'aField',
734 ],
735 ],
736 ],
737 ],
738 ];
739 $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
740 'type' => 'group',
741 'internal_type' => 'db',
742 ];
743 $this->expectException(\UnexpectedValueException::class);
744 $this->expectExceptionCode(1445078628);
745 $this->subject->addData($input);
746 }
747
748 /**
749 * @test
750 */
751 public function addDataAddsSelectorOrUniqueConfigurationForForeignUnique()
752 {
753 $input = [
754 'processedTca' => [
755 'columns' => [
756 'aField' => [
757 'config' => [
758 'type' => 'inline',
759 'foreign_table' => 'aForeignTableName',
760 'foreign_unique' => 'aField',
761 ],
762 ],
763 ],
764 ],
765 ];
766 $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
767 'type' => 'select',
768 'foreign_table' => 'anotherForeignTableName',
769 ];
770 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
771 $expected['processedTca']['columns']['aField']['config']['foreign_unique'] = 'aField';
772 $expected['processedTca']['columns']['aField']['config']['selectorOrUniqueConfiguration'] = [
773 'fieldName' => 'aField',
774 'isSelector' => false,
775 'isUnique' => true,
776 'config' => [
777 'type' => 'select',
778 'foreign_table' => 'anotherForeignTableName',
779 ],
780 'foreignTable' => 'anotherForeignTableName',
781 ];
782 $this->assertEquals($expected, $this->subject->addData($input));
783 }
784
785 /**
786 * @test
787 */
788 public function addDataMergesForeignSelectorFieldTcaOverride()
789 {
790 $input = [
791 'processedTca' => [
792 'columns' => [
793 'aField' => [
794 'config' => [
795 'type' => 'inline',
796 'foreign_table' => 'aForeignTableName',
797 'foreign_selector' => 'aField',
798 'foreign_selector_fieldTcaOverride' => [
799 'config' => [
800 'aGivenSetting' => 'aOverrideValue',
801 'aNewSetting' => 'aNewSetting',
802 'appearance' => [
803 'elementBrowserType' => 'file',
804 'elementBrowserAllowed' => 'jpg,png',
805 ],
806 ],
807 ],
808 ],
809 ],
810 ],
811 ],
812 ];
813 $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
814 'type' => 'group',
815 'internal_type' => 'db',
816 'allowed' => 'anotherForeignTableName',
817 'doNotChangeMe' => 'doNotChangeMe',
818 'aGivenSetting' => 'aGivenValue',
819 ];
820
821 $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
822 $expected['processedTca']['columns']['aField']['config']['appearance']['levelLinksPosition'] = 'none';
823 $expected['processedTca']['columns']['aField']['config']['foreign_selector'] = 'aField';
824 $expected['processedTca']['columns']['aField']['config']['foreign_selector_fieldTcaOverride'] = [
825 'config' => [
826 'aGivenSetting' => 'aOverrideValue',
827 'aNewSetting' => 'aNewSetting',
828 'appearance' => [
829 'elementBrowserType' => 'file',
830 'elementBrowserAllowed' => 'jpg,png',
831 ],
832 ],
833 ];
834
835 $expected['processedTca']['columns']['aField']['config']['selectorOrUniqueConfiguration'] = [
836 'fieldName' => 'aField',
837 'isSelector' => true,
838 'isUnique' => false,
839 'config' => [
840 'type' => 'group',
841 'internal_type' => 'db',
842 'allowed' => 'anotherForeignTableName',
843 'doNotChangeMe' => 'doNotChangeMe',
844 'aGivenSetting' => 'aOverrideValue',
845 'aNewSetting' => 'aNewSetting',
846 'appearance' => [
847 'elementBrowserType' => 'file',
848 'elementBrowserAllowed' => 'jpg,png',
849 ],
850 ],
851 'foreignTable' => 'anotherForeignTableName',
852 ];
853 $this->assertEquals($expected, $this->subject->addData($input));
854 }
855 }