‪TYPO3CMS  10.4
TcaColumnsProcessShowitemTest.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 ‪TcaColumnsProcessShowitemTest extends UnitTestCase
25 {
30  {
31  $input = [
32  'recordTypeValue' => 'aType',
33  'tableName' => 'aTable',
34  'processedTca' => [
35  'columns' => [
36  'aField' => [
37  'type' => 'aType',
38  ],
39  ],
40  'types' => [
41  'aType' => [],
42  ],
43  ],
44  ];
45  $this->expectException(\UnexpectedValueException::class);
46  $this->expectExceptionCode(1438614542);
47  (new ‪TcaColumnsProcessShowitem())->addData($input);
48  }
49 
54  {
55  $input = [
56  'columnsToProcess' => [],
57  'databaseRow' => [],
58  'recordTypeValue' => 'aType',
59  'isInlineChild' => false,
60  'processedTca' => [
61  'types' => [
62  'aType' => [
63  'showitem' => 'keepMe'
64  ],
65  ],
66  'columns' => [
67  'keepMe' => [
68  'config' => [
69  'type' => 'input',
70  ]
71  ],
72  'aField' => [
73  'config' => [
74  'type' => 'input',
75  ]
76  ]
77  ]
78  ]
79  ];
80 
81  $expected = $input;
82  $expected['columnsToProcess'] = ['keepMe'];
83 
84  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
85  }
86 
91  {
92  $input = [
93  'columnsToProcess' => [],
94  'databaseRow' => [],
95  'recordTypeValue' => 'aType',
96  'isInlineChild' => false,
97  'processedTca' => [
98  'types' => [
99  'aType' => [
100  'showitem' => '--palette--;;aPalette'
101  ],
102  ],
103  'palettes' => [
104  'aPalette' => [
105  'showitem' => 'keepMe',
106  ],
107  ],
108  'columns' => [
109  'keepMe' => [
110  'config' => [
111  'type' => 'input',
112  ]
113  ],
114  'bField' => [
115  'config' => [
116  'type' => 'input',
117  ]
118  ]
119  ]
120  ]
121  ];
122 
123  $expected = $input;
124  $expected['columnsToProcess'] = ['keepMe'];
125 
126  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
127  }
128 
133  {
134  $input = [
135  'databaseRow' => [],
136  'recordTypeValue' => 'aType',
137  'isInlineChild' => false,
138  'processedTca' => [
139  'types' => [
140  'aType' => [
141  'showitem' => '--palette--;;aPalette, anotherField'
142  ],
143  ],
144  'palettes' => [
145  'aPalette' => [
146  'showitem' => 'aField',
147  ],
148  ],
149  'columns' => [
150  'aField' => [
151  'config' => [
152  'type' => 'input',
153  ]
154  ],
155  'removeMe' => [
156  'config' => [
157  'type' => 'input',
158  ]
159  ],
160  'anotherField' => [
161  'config' => [
162  'type' => 'input',
163  ]
164  ]
165  ]
166  ]
167  ];
168 
169  $expected = $input;
170  $expected['columnsToProcess'] = ['aField', 'anotherField'];
171 
172  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
173  }
174 
179  {
180  $input = [
181  'command' => 'edit',
182  'databaseRow' => [
183  'uid' => 42,
184  ],
185  'recordTypeValue' => 'aType',
186  'processedTca' => [
187  'types' => [
188  'aType' => [
189  'showitem' => 'aField',
190  ],
191  ],
192  'columns' => [
193  'aField' => [
194  'config' => [
195  'type' => 'input',
196  ]
197  ],
198  ],
199  ],
200  'inlineParentConfig' => [
201  'foreign_table' => 'aTable',
202  ],
203  'isInlineChild' => true,
204  'isInlineChildExpanded' => false,
205  'isInlineAjaxOpeningContext' => false,
206  'inlineExpandCollapseStateArray' => [],
207  ];
208  $expected = $input;
209  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
210  }
211 
216  {
217  $input = [
218  'command' => 'edit',
219  'databaseRow' => [
220  'uid' => 42,
221  ],
222  'recordTypeValue' => 'aType',
223  'processedTca' => [
224  'types' => [
225  'aType' => [
226  'showitem' => 'aField',
227  ],
228  ],
229  'columns' => [
230  'aField' => [
231  'config' => [
232  'type' => 'input',
233  ]
234  ],
235  ],
236  ],
237  'inlineParentConfig' => [
238  'foreign_table' => 'aTable',
239  'appearance' => [
240  'collapseAll' => true,
241  ],
242  ],
243  'isInlineChild' => true,
244  'isInlineChildExpanded' => false,
245  'isInlineAjaxOpeningContext' => false,
246  'inlineExpandCollapseStateArray' => [
247  'aTable' => [
248  42,
249  ],
250  ],
251  ];
252  $expected = $input;
253  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
254  }
255 
260  {
261  $input = [
262  'command' => 'edit',
263  'databaseRow' => [
264  'uid' => 42,
265  ],
266  'recordTypeValue' => 'aType',
267  'processedTca' => [
268  'types' => [
269  'aType' => [
270  'showitem' => 'aField',
271  ],
272  ],
273  'columns' => [
274  'aField' => [
275  'config' => [
276  'type' => 'input',
277  ]
278  ],
279  ],
280  ],
281  'inlineParentConfig' => [
282  'foreign_table' => 'aTable',
283  ],
284  'isInlineChild' => true,
285  'isInlineChildExpanded' => true,
286  'isInlineAjaxOpeningContext' => false,
287  'inlineExpandCollapseStateArray' => [
288  'aTable' => [
289  42,
290  ],
291  ],
292  ];
293  $expected = $input;
294  $expected['columnsToProcess'] = ['aField'];
295  self::assertSame($expected, (new ‪TcaColumnsProcessShowitem())->addData($input));
296  }
297 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataSkipsColumnsForCollapsedInlineChild
‪addDataSkipsColumnsForCollapsedInlineChild()
Definition: TcaColumnsProcessShowitemTest.php:178
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataRegistersColumnsFieldReferencedInShowitems
‪addDataRegistersColumnsFieldReferencedInShowitems()
Definition: TcaColumnsProcessShowitemTest.php:53
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataSkipsColumnsNotReferencedInShowitemOrPalette
‪addDataSkipsColumnsNotReferencedInShowitemOrPalette()
Definition: TcaColumnsProcessShowitemTest.php:132
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataAddsColumnsForExpandedInlineChild
‪addDataAddsColumnsForExpandedInlineChild()
Definition: TcaColumnsProcessShowitemTest.php:259
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessShowitem
Definition: TcaColumnsProcessShowitem.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataThrowsExceptionIfTypesHasNoShowitem
‪addDataThrowsExceptionIfTypesHasNoShowitem()
Definition: TcaColumnsProcessShowitemTest.php:29
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest
Definition: TcaColumnsProcessShowitemTest.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataSkipsColumnsForCollapsedAllInlineChild
‪addDataSkipsColumnsForCollapsedAllInlineChild()
Definition: TcaColumnsProcessShowitemTest.php:215
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessShowitemTest\addDataKeepsColumnsFieldReferencedInPalette
‪addDataKeepsColumnsFieldReferencedInPalette()
Definition: TcaColumnsProcessShowitemTest.php:90
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18