TYPO3 CMS  TYPO3_7-6
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 
19 
24 {
28  protected $subject;
29 
30  protected function setUp()
31  {
32  $this->subject = new TcaColumnsProcessShowitem();
33  }
34 
39  {
40  $input = [
41  'recordTypeValue' => 'aType',
42  'processedTca' => [
43  'columns' => [
44  'aField' => [
45  'type' => 'aType',
46  ],
47  ],
48  'types' => [
49  'aType' => [],
50  ],
51  ],
52  ];
53  $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1438614542);
54  $this->subject->addData($input);
55  }
56 
61  {
62  $input = [
63  'columnsToProcess' => [],
64  'databaseRow' => [],
65  'recordTypeValue' => 'aType',
66  'processedTca' => [
67  'types' => [
68  'aType' => [
69  'showitem' => 'keepMe'
70  ],
71  ],
72  'columns' => [
73  'keepMe' => [
74  'config' => [
75  'type' => 'input',
76  ]
77  ],
78  'aField' => [
79  'config' => [
80  'type' => 'input',
81  ]
82  ]
83  ]
84  ]
85  ];
86 
87  $expected = $input;
88  $expected['columnsToProcess'] = ['keepMe'];
89 
90  $this->assertSame($expected, $this->subject->addData($input));
91  }
92 
97  {
98  $input = [
99  'columnsToProcess' => [],
100  'databaseRow' => [],
101  'recordTypeValue' => 'aType',
102  'processedTca' => [
103  'types' => [
104  'aType' => [
105  'showitem' => '--palette--;;aPalette'
106  ],
107  ],
108  'palettes' => [
109  'aPalette' => [
110  'showitem' => 'keepMe',
111  ],
112  ],
113  'columns' => [
114  'keepMe' => [
115  'config' => [
116  'type' => 'input',
117  ]
118  ],
119  'bField' => [
120  'config' => [
121  'type' => 'input',
122  ]
123  ]
124  ]
125  ]
126  ];
127 
128  $expected = $input;
129  $expected['columnsToProcess'] = ['keepMe'];
130 
131  $this->assertSame($expected, $this->subject->addData($input));
132  }
133 
138  {
139  $input = [
140  'databaseRow' => [],
141  'recordTypeValue' => 'aType',
142  'processedTca' => [
143  'types' => [
144  'aType' => [
145  'showitem' => '--palette--;;aPalette, anotherField'
146  ],
147  ],
148  'palettes' => [
149  'aPalette' => [
150  'showitem' => 'aField',
151  ],
152  ],
153  'columns' => [
154  'aField' => [
155  'config' => [
156  'type' => 'input',
157  ]
158  ],
159  'removeMe' => [
160  'config' => [
161  'type' => 'input',
162  ]
163  ],
164  'anotherField' => [
165  'config' => [
166  'type' => 'input',
167  ]
168  ]
169  ]
170  ]
171  ];
172 
173  $expected = $input;
174  $expected['columnsToProcess'] = ['aField', 'anotherField'];
175 
176  $this->assertSame($expected, $this->subject->addData($input));
177  }
178 
183  {
184  $input = [
185  'command' => 'edit',
186  'databaseRow' => [
187  'uid' => 42,
188  ],
189  'recordTypeValue' => 'aType',
190  'processedTca' => [
191  'types' => [
192  'aType' => [
193  'showitem' => 'aField',
194  ],
195  ],
196  'columns' => [
197  'aField' => [
198  'config' => [
199  'type' => 'input',
200  ]
201  ],
202  ],
203  ],
204  'inlineParentConfig' => [
205  'foreign_table' => 'aTable',
206  ],
207  'isInlineChild' => true,
208  'isInlineAjaxOpeningContext' => false,
209  'inlineExpandCollapseStateArray' => [],
210  ];
211  $expected = $input;
212  $this->assertSame($expected, $this->subject->addData($input));
213  }
214 
219  {
220  $input = [
221  'command' => 'edit',
222  'databaseRow' => [
223  'uid' => 42,
224  ],
225  'recordTypeValue' => 'aType',
226  'processedTca' => [
227  'types' => [
228  'aType' => [
229  'showitem' => 'aField',
230  ],
231  ],
232  'columns' => [
233  'aField' => [
234  'config' => [
235  'type' => 'input',
236  ]
237  ],
238  ],
239  ],
240  'inlineParentConfig' => [
241  'foreign_table' => 'aTable',
242  'appearance' => [
243  'collapseAll' => true,
244  ],
245  ],
246  'isInlineChild' => true,
247  'isInlineChildExpanded' => false,
248  'isInlineAjaxOpeningContext' => false,
249  'inlineExpandCollapseStateArray' => [
250  'aTable' => [
251  42,
252  ],
253  ],
254  ];
255  $expected = $input;
256  $this->assertSame($expected, $this->subject->addData($input));
257  }
258 
263  {
264  $input = [
265  'command' => 'edit',
266  'databaseRow' => [
267  'uid' => 42,
268  ],
269  'recordTypeValue' => 'aType',
270  'processedTca' => [
271  'types' => [
272  'aType' => [
273  'showitem' => 'aField',
274  ],
275  ],
276  'columns' => [
277  'aField' => [
278  'config' => [
279  'type' => 'input',
280  ]
281  ],
282  ],
283  ],
284  'inlineParentConfig' => [
285  'foreign_table' => 'aTable',
286  ],
287  'isInlineChild' => true,
288  'isInlineChildExpanded' => true,
289  'isInlineAjaxOpeningContext' => false,
290  'inlineExpandCollapseStateArray' => [
291  'aTable' => [
292  42,
293  ],
294  ],
295  ];
296  $expected = $input;
297  $expected['columnsToProcess'] = ['aField'];
298  $this->assertSame($expected, $this->subject->addData($input));
299  }
300 }