TYPO3 CMS  TYPO3_7-6
InlineOverrrideChildTcaTest.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 InlineOverrideChildTca();
33  }
34 
39  {
40  $input = [
41  'inlineParentConfig' => [
42  'foreign_types' => [
43  'aType' => [
44  'showitem' => 'keepMe',
45  ],
46  ],
47  ],
48  'processedTca' => [
49  'types' => [
50  'aType' => [
51  'showitem' => 'keepMe, aField',
52  ],
53  'bType' => [
54  'showitem' => 'keepMe, aField',
55  ],
56  ],
57  ],
58  ];
59 
60  $expected = $input;
61  $expected['processedTca']['types']['aType']['showitem'] = 'keepMe';
62 
63  $this->assertSame($expected, $this->subject->addData($input));
64  }
65 
70  {
71  $input = [
72  'inlineParentConfig' => [
73  'foreign_types' => [
74  'aType' => [
75  'showitem' => 'keepMe',
76  ],
77  'cType' => [
78  'showitem' => 'keepMe',
79  ],
80  ],
81  ],
82  'processedTca' => [
83  'types' => [
84  'aType' => [
85  'showitem' => 'keepMe, aField',
86  ],
87  'bType' => [
88  'showitem' => 'keepMe, aField',
89  ],
90  ],
91  ],
92  ];
93 
94  $expected = $input;
95  $expected['processedTca']['types']['aType']['showitem'] = 'keepMe';
96  $expected['processedTca']['types']['cType']['showitem'] = 'keepMe';
97 
98  $this->assertSame($expected, $this->subject->addData($input));
99  }
100 
105  {
106  $input = [
107  'inlineParentConfig' => [
108  'foreign_selector' => 'uid_local',
109  'foreign_selector_fieldTcaOverride' => [
110  'label' => 'aDifferentLabel',
111  'config' => [
112  'aGivenSetting' => 'overrideValue',
113  'aNewSetting' => 'anotherNewValue',
114  'appearance' => [
115  'elementBrowserType' => 'file',
116  'elementBrowserAllowed' => 'jpg,png'
117  ],
118  ],
119  ],
120  ],
121  'processedTca' => [
122  'columns' => [
123  'uid_local' => [
124  'label' => 'aLabel',
125  'config' => [
126  'aGivenSetting' => 'aValue',
127  'doNotChangeMe' => 'doNotChangeMe',
128  'appearance' => [
129  'elementBrowserType' => 'db',
130  ],
131  ],
132  ]
133  ],
134  ],
135  ];
136 
137  $expected = $input;
138  $expected['processedTca']['columns']['uid_local'] = [
139  'label' => 'aDifferentLabel',
140  'config' => [
141  'aGivenSetting' => 'overrideValue',
142  'doNotChangeMe' => 'doNotChangeMe',
143  'appearance' => [
144  'elementBrowserType' => 'file',
145  'elementBrowserAllowed' => 'jpg,png',
146  ],
147  'aNewSetting' => 'anotherNewValue',
148  ],
149  ];
150 
151  $this->assertSame($expected, $this->subject->addData($input));
152  }
153 
158  {
159  $GLOBALS['TCA']['aTable']['columns']['aType'] = [];
160  $input = [
161  'inlineParentConfig' => [
162  'foreign_table' => 'aTable',
163  'foreign_record_defaults' => [
164  'aType' => '42',
165  ],
166  ],
167  'processedTca' => [
168  'columns' => [
169  'aType' => [
170  'config' => [],
171  ],
172  ],
173  ],
174  ];
175 
176  $expected = $input;
177  $expected['processedTca']['columns']['aType']['config']['default'] = '42';
178 
179  $this->assertSame($expected, $this->subject->addData($input));
180  }
181 
186  {
187  $GLOBALS['TCA']['aTable']['columns']['pid'] = [];
188  $input = [
189  'inlineParentConfig' => [
190  'foreign_table' => 'aTable',
191  'foreign_record_defaults' => [
192  'pid' => '42',
193  ],
194  ],
195  'processedTca' => [
196  'columns' => [
197  'aType' => [
198  'config' => [],
199  ],
200  ],
201  ],
202  ];
203 
204  $expected = $input;
205 
206  $this->assertSame($expected, $this->subject->addData($input));
207  }
208 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']