‪TYPO3CMS  11.5
TcaColumnsProcessShowitemTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪TcaColumnsProcessShowitemTest extends UnitTestCase
27 {
32  {
33  $input = [
34  'recordTypeValue' => 'aType',
35  'tableName' => 'aTable',
36  'processedTca' => [
37  'columns' => [
38  'aField' => [
39  'type' => 'aType',
40  ],
41  ],
42  'types' => [
43  'aType' => [],
44  ],
45  ],
46  ];
47  $this->expectException(\UnexpectedValueException::class);
48  $this->expectExceptionCode(1438614542);
49  (new ‪TcaColumnsProcessShowitem())->addData($input);
50  }
51 
56  {
57  $input = [
58  'columnsToProcess' => [],
59  'databaseRow' => [],
60  'recordTypeValue' => 'aType',
61  'isInlineChild' => false,
62  'processedTca' => [
63  'types' => [
64  'aType' => [
65  'showitem' => 'keepMe',
66  ],
67  ],
68  'columns' => [
69  'keepMe' => [
70  'config' => [
71  'type' => 'input',
72  ],
73  ],
74  'aField' => [
75  'config' => [
76  'type' => 'input',
77  ],
78  ],
79  ],
80  ],
81  ];
82 
83  $expected = $input;
84  $expected['columnsToProcess'] = ['keepMe'];
85 
86  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
87  }
88 
93  {
94  $input = [
95  'columnsToProcess' => [],
96  'databaseRow' => [],
97  'recordTypeValue' => 'aType',
98  'isInlineChild' => false,
99  'processedTca' => [
100  'types' => [
101  'aType' => [
102  'showitem' => '--palette--;;aPalette',
103  ],
104  ],
105  'palettes' => [
106  'aPalette' => [
107  'showitem' => 'keepMe',
108  ],
109  ],
110  'columns' => [
111  'keepMe' => [
112  'config' => [
113  'type' => 'input',
114  ],
115  ],
116  'bField' => [
117  'config' => [
118  'type' => 'input',
119  ],
120  ],
121  ],
122  ],
123  ];
124 
125  $expected = $input;
126  $expected['columnsToProcess'] = ['keepMe'];
127 
128  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
129  }
130 
135  {
136  $input = [
137  'databaseRow' => [],
138  'recordTypeValue' => 'aType',
139  'isInlineChild' => false,
140  'processedTca' => [
141  'types' => [
142  'aType' => [
143  'showitem' => '--palette--;;aPalette, anotherField',
144  ],
145  ],
146  'palettes' => [
147  'aPalette' => [
148  'showitem' => 'aField',
149  ],
150  ],
151  'columns' => [
152  'aField' => [
153  'config' => [
154  'type' => 'input',
155  ],
156  ],
157  'removeMe' => [
158  'config' => [
159  'type' => 'input',
160  ],
161  ],
162  'anotherField' => [
163  'config' => [
164  'type' => 'input',
165  ],
166  ],
167  ],
168  ],
169  ];
170 
171  $expected = $input;
172  $expected['columnsToProcess'] = ['aField', 'anotherField'];
173 
174  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
175  }
176 
181  {
182  $input = [
183  'command' => 'edit',
184  'databaseRow' => [
185  'uid' => 42,
186  ],
187  'recordTypeValue' => 'aType',
188  'processedTca' => [
189  'types' => [
190  'aType' => [
191  'showitem' => 'aField',
192  ],
193  ],
194  'columns' => [
195  'aField' => [
196  'config' => [
197  'type' => 'input',
198  ],
199  ],
200  ],
201  ],
202  'inlineParentConfig' => [
203  'foreign_table' => 'aTable',
204  ],
205  'isInlineChild' => true,
206  'isInlineChildExpanded' => false,
207  'isInlineAjaxOpeningContext' => false,
208  'inlineExpandCollapseStateArray' => [],
209  ];
210  $expected = $input;
211  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
212  }
213 
218  {
219  $input = [
220  'command' => 'edit',
221  'databaseRow' => [
222  'uid' => 42,
223  ],
224  'recordTypeValue' => 'aType',
225  'processedTca' => [
226  'types' => [
227  'aType' => [
228  'showitem' => 'aField',
229  ],
230  ],
231  'columns' => [
232  'aField' => [
233  'config' => [
234  'type' => 'input',
235  ],
236  ],
237  ],
238  ],
239  'inlineParentConfig' => [
240  'foreign_table' => 'aTable',
241  'appearance' => [
242  'collapseAll' => true,
243  ],
244  ],
245  'isInlineChild' => true,
246  'isInlineChildExpanded' => false,
247  'isInlineAjaxOpeningContext' => false,
248  'inlineExpandCollapseStateArray' => [
249  'aTable' => [
250  42,
251  ],
252  ],
253  ];
254  $expected = $input;
255  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
256  }
257 
262  {
263  $input = [
264  'command' => 'edit',
265  'databaseRow' => [
266  'uid' => 42,
267  ],
268  'recordTypeValue' => 'aType',
269  'processedTca' => [
270  'types' => [
271  'aType' => [
272  'showitem' => 'aField',
273  ],
274  ],
275  'columns' => [
276  'aField' => [
277  'config' => [
278  'type' => 'input',
279  ],
280  ],
281  ],
282  ],
283  'inlineParentConfig' => [
284  'foreign_table' => 'aTable',
285  ],
286  'isInlineChild' => true,
287  'isInlineChildExpanded' => true,
288  'isInlineAjaxOpeningContext' => false,
289  'inlineExpandCollapseStateArray' => [
290  'aTable' => [
291  42,
292  ],
293  ],
294  ];
295  $expected = $input;
296  $expected['columnsToProcess'] = ['aField'];
297  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
298  }
299 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataSkipsColumnsForCollapsedInlineChild
‪addDataSkipsColumnsForCollapsedInlineChild()
Definition: TcaColumnsProcessShowitemTest.php:180
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataRegistersColumnsFieldReferencedInShowitems
‪addDataRegistersColumnsFieldReferencedInShowitems()
Definition: TcaColumnsProcessShowitemTest.php:55
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataSkipsColumnsNotReferencedInShowitemOrPalette
‪addDataSkipsColumnsNotReferencedInShowitemOrPalette()
Definition: TcaColumnsProcessShowitemTest.php:134
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataAddsColumnsForExpandedInlineChild
‪addDataAddsColumnsForExpandedInlineChild()
Definition: TcaColumnsProcessShowitemTest.php:261
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessShowitem
Definition: TcaColumnsProcessShowitem.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataThrowsExceptionIfTypesHasNoShowitem
‪addDataThrowsExceptionIfTypesHasNoShowitem()
Definition: TcaColumnsProcessShowitemTest.php:31
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest
Definition: TcaColumnsProcessShowitemTest.php:27
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataSkipsColumnsForCollapsedAllInlineChild
‪addDataSkipsColumnsForCollapsedAllInlineChild()
Definition: TcaColumnsProcessShowitemTest.php:217
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataKeepsColumnsFieldReferencedInPalette
‪addDataKeepsColumnsFieldReferencedInPalette()
Definition: TcaColumnsProcessShowitemTest.php:92
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18