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