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