‪TYPO3CMS  10.4
TcaColumnsProcessCommonTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪TcaColumnsProcessCommonTest extends UnitTestCase
25 {
30  {
31  $input = [
32  'recordTypeValue' => 'aType',
33  'columnsToProcess' => [],
34  'processedTca' => [
35  'ctrl' => [
36  'origUid' => 't3_origuid'
37  ]
38  ]
39  ];
40 
41  $expected = $input;
42  $expected['columnsToProcess'] = ['t3_origuid'];
43  self::assertSame($expected, (new ‪TcaColumnsProcessCommon())->addData($input));
44  }
45 
50  {
51  $input = [
52  'recordTypeValue' => 'aType',
53  'columnsToProcess' => [],
54  'processedTca' => [
55  'ctrl' => [
56  'type' => 'doktype'
57  ]
58  ]
59  ];
60 
61  $expected = $input;
62  $expected['columnsToProcess'] = ['doktype'];
63  self::assertSame($expected, (new ‪TcaColumnsProcessCommon())->addData($input));
64  }
65 
70  {
71  $input = [
72  'recordTypeValue' => 'aType',
73  'columnsToProcess' => [],
74  'processedTca' => [
75  'ctrl' => [
76  'type' => 'relation_field:foreign_type_field'
77  ]
78  ]
79  ];
80 
81  $expected = $input;
82  $expected['columnsToProcess'] = ['relation_field'];
83  self::assertSame($expected, (new ‪TcaColumnsProcessCommon())->addData($input));
84  }
85 
90  {
91  $input = [
92  'recordTypeValue' => 'aType',
93  'columnsToProcess' => [],
94  'processedTca' => [
95  'ctrl' => [
96  'languageField' => 'sys_language_uid'
97  ]
98  ]
99  ];
100 
101  $expected = $input;
102  $expected['columnsToProcess'] = ['sys_language_uid'];
103  self::assertSame($expected, (new ‪TcaColumnsProcessCommon())->addData($input));
104  }
105 
110  {
111  $input = [
112  'recordTypeValue' => 'aType',
113  'columnsToProcess' => [],
114  'processedTca' => [
115  'ctrl' => [
116  'transOrigPointerField' => 'l10n_parent'
117  ]
118  ]
119  ];
120 
121  $expected = $input;
122  $expected['columnsToProcess'] = ['l10n_parent'];
123  self::assertSame($expected, (new ‪TcaColumnsProcessCommon())->addData($input));
124  }
125 
130  {
131  $input = [
132  'recordTypeValue' => 'aType',
133  'columnsToProcess' => [],
134  'processedTca' => [
135  'ctrl' => [
136  'transOrigDiffSourceField' => 'l18n_diffsource'
137  ]
138  ]
139  ];
140 
141  $expected = $input;
142  $expected['columnsToProcess'] = ['l18n_diffsource'];
143  self::assertSame($expected, (new ‪TcaColumnsProcessCommon())->addData($input));
144  }
145 
150  {
151  $input = [
152  'recordTypeValue' => 'list',
153  'columnsToProcess' => [],
154  'processedTca' => [
155  'ctrl' => [],
156  'types' => [
157  'list' => [
158  'subtype_value_field' => 'list_type',
159  'subtypes_addlist' => [
160  'aType' => 'aField',
161  ]
162  ],
163  ],
164  ],
165  'databaseRow' => [
166  'list_type' => 'aType',
167  ],
168  ];
169 
170  $expected = $input;
171  $expected['columnsToProcess'] = ['aField'];
172  self::assertSame($expected, (new ‪TcaColumnsProcessCommon())->addData($input));
173  }
174 
179  {
180  $input = [
181  'recordTypeValue' => 'aType',
182  'columnsToProcess' => [],
183  'processedTca' => [
184  'ctrl' => [],
185  'types' => [
186  'aType' => [
187  'subtype_value_field' => 'theSubtypeValueField',
188  'subtypes_addlist' => [
189  'theSubtypeValue' => 'aField, bField',
190  ]
191  ],
192  ],
193  ],
194  'databaseRow' => [
195  'theSubtypeValueField' => 'theSubtypeValue',
196  ],
197  ];
198 
199  $expected = $input;
200  $expected['columnsToProcess'] = ['aField', 'bField'];
201  self::assertSame($expected, (new ‪TcaColumnsProcessCommon())->addData($input));
202  }
203 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessCommon
Definition: TcaColumnsProcessCommon.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest\addDataRegistersMultipleSubtypesAddlistFields
‪addDataRegistersMultipleSubtypesAddlistFields()
Definition: TcaColumnsProcessCommonTest.php:178
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest\addDataRegistersLanguageFieldColumn
‪addDataRegistersLanguageFieldColumn()
Definition: TcaColumnsProcessCommonTest.php:89
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest\addDataRegistersRecordTypeRelationColumn
‪addDataRegistersRecordTypeRelationColumn()
Definition: TcaColumnsProcessCommonTest.php:69
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest\addDataRegistersSingleSubtypesAddlistFields
‪addDataRegistersSingleSubtypesAddlistFields()
Definition: TcaColumnsProcessCommonTest.php:149
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest\addDataRegistersOrigUidColumn
‪addDataRegistersOrigUidColumn()
Definition: TcaColumnsProcessCommonTest.php:29
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest\addDataRegistersRecordTypeColumn
‪addDataRegistersRecordTypeColumn()
Definition: TcaColumnsProcessCommonTest.php:49
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest\addDataRegistersTransOrigPointerColumn
‪addDataRegistersTransOrigPointerColumn()
Definition: TcaColumnsProcessCommonTest.php:109
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest\addDataRegistersTransOrigDiffSourceColumn
‪addDataRegistersTransOrigDiffSourceColumn()
Definition: TcaColumnsProcessCommonTest.php:129
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessCommonTest
Definition: TcaColumnsProcessCommonTest.php:25