TYPO3 CMS  TYPO3_7-6
TcaColumnsProcessCommonTest.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 TcaColumnsProcessCommon();
33  }
34 
39  {
40  $input = [
41  'columnsToProcess' => [],
42  'processedTca' => [
43  'ctrl' => [
44  'origUid' => 't3_origuid'
45  ]
46  ]
47  ];
48 
49  $expected = $input;
50  $expected['columnsToProcess'] = ['t3_origuid'];
51  $this->assertSame($expected, $this->subject->addData($input));
52  }
53 
58  {
59  $input = [
60  'columnsToProcess' => [],
61  'processedTca' => [
62  'ctrl' => [
63  'type' => 'doktype'
64  ]
65  ]
66  ];
67 
68  $expected = $input;
69  $expected['columnsToProcess'] = ['doktype'];
70  $this->assertSame($expected, $this->subject->addData($input));
71  }
72 
77  {
78  $input = [
79  'columnsToProcess' => [],
80  'processedTca' => [
81  'ctrl' => [
82  'type' => 'relation_field:foreign_type_field'
83  ]
84  ]
85  ];
86 
87  $expected = $input;
88  $expected['columnsToProcess'] = ['relation_field'];
89  $this->assertSame($expected, $this->subject->addData($input));
90  }
91 
96  {
97  $input = [
98  'columnsToProcess' => [],
99  'processedTca' => [
100  'ctrl' => [
101  'languageField' => 'sys_language_uid'
102  ]
103  ]
104  ];
105 
106  $expected = $input;
107  $expected['columnsToProcess'] = ['sys_language_uid'];
108  $this->assertSame($expected, $this->subject->addData($input));
109  }
110 
115  {
116  $input = [
117  'columnsToProcess' => [],
118  'processedTca' => [
119  'ctrl' => [
120  'transOrigPointerField' => 'l10n_parent'
121  ]
122  ]
123  ];
124 
125  $expected = $input;
126  $expected['columnsToProcess'] = ['l10n_parent'];
127  $this->assertSame($expected, $this->subject->addData($input));
128  }
129 
134  {
135  $input = [
136  'columnsToProcess' => [],
137  'processedTca' => [
138  'ctrl' => [
139  'transOrigDiffSourceField' => 'l18n_diffsource'
140  ]
141  ]
142  ];
143 
144  $expected = $input;
145  $expected['columnsToProcess'] = ['l18n_diffsource'];
146  $this->assertSame($expected, $this->subject->addData($input));
147  }
148 
153  {
154  $input = [
155  'recordTypeValue' => 'list',
156  'columnsToProcess' => [],
157  'processedTca' => [
158  'types' => [
159  'list' => [
160  'subtype_value_field' => 'list_type',
161  'subtypes_addlist' => [
162  'aType' => 'aField',
163  ]
164  ],
165  ],
166  ],
167  'databaseRow' => [
168  'list_type' => 'aType',
169  ],
170  ];
171 
172  $expected = $input;
173  $expected['columnsToProcess'] = ['aField'];
174  $this->assertSame($expected, $this->subject->addData($input));
175  }
176 
181  {
182  $input = [
183  'recordTypeValue' => 'aType',
184  'columnsToProcess' => [],
185  'processedTca' => [
186  'types' => [
187  'aType' => [
188  'subtype_value_field' => 'theSubtypeValueField',
189  'subtypes_addlist' => [
190  'theSubtypeValue' => 'aField, bField',
191  ]
192  ],
193  ],
194  ],
195  'databaseRow' => [
196  'theSubtypeValueField' => 'theSubtypeValue',
197  ],
198  ];
199 
200  $expected = $input;
201  $expected['columnsToProcess'] = ['aField', 'bField'];
202  $this->assertSame($expected, $this->subject->addData($input));
203  }
204 }