[BUGFIX] Allow processing of multiple new record localizations
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / IRRE / ForeignField / AbstractActionTestCase.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\IRRE\ForeignField;
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
17 use TYPO3\CMS\Core\Utility\StringUtility;
18
19 /**
20 * Functional test for the DataHandler
21 */
22 abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
23 {
24 const VALUE_PageId = 89;
25 const VALUE_PageIdTarget = 90;
26 const VALUE_PageIdWebsite = 1;
27 const VALUE_ContentIdFirst = 297;
28 const VALUE_ContentIdLast = 298;
29 const VALUE_HotelIdFirst = 3;
30 const VALUE_HotelIdSecond = 4;
31 const VALUE_HotelIdThird = 5;
32 const VALUE_LanguageId = 1;
33 const VALUE_LanguageIdSecond = 2;
34
35 const TABLE_Page = 'pages';
36 const TABLE_PageOverlay = 'pages_language_overlay';
37 const TABLE_Content = 'tt_content';
38 const TABLE_Hotel = 'tx_irretutorial_1nff_hotel';
39 const TABLE_Offer = 'tx_irretutorial_1nff_offer';
40 const TABLE_Price = 'tx_irretutorial_1nff_price';
41
42 const FIELD_PageHotel = 'tx_irretutorial_hotels';
43 const FIELD_ContentHotel = 'tx_irretutorial_1nff_hotels';
44 const FIELD_HotelOffer = 'offers';
45 const FIELD_OfferPrice = 'prices';
46
47 /**
48 * @var string
49 */
50 protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/IRRE/ForeignField/DataSet/';
51
52 protected function setUp()
53 {
54 parent::setUp();
55 $this->importScenarioDataSet('LiveDefaultPages');
56 $this->importScenarioDataSet('LiveDefaultElements');
57
58 $this->setUpFrontendRootPage(
59 1,
60 [
61 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
62 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/ExtbaseJsonRenderer.ts',
63 ]
64 );
65 $this->backendUser->workspace = 0;
66 }
67
68 /**
69 * Parent content records
70 */
71
72 /**
73 * @see DataSet/createParentContentRecord.csv
74 */
75 public function createParentContent()
76 {
77 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
78 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
79 }
80
81 /**
82 * @see DataSet/modifyParentContentRecord.csv
83 */
84 public function modifyParentContent()
85 {
86 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, ['header' => 'Testing #1']);
87 }
88
89 /**
90 * @see DataSet/deleteParentContentRecord.csv
91 */
92 public function deleteParentContent()
93 {
94 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
95 }
96
97 /**
98 * @see DataSet/copyParentContentRecord.csv
99 */
100 public function copyParentContent()
101 {
102 $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
103 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
104 }
105
106 /**
107 * @see DataSet/copyParentContentToDifferentPage.csv
108 */
109 public function copyParentContentToDifferentPage()
110 {
111 $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
112 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
113 }
114
115 /**
116 * @see DataSet/copyParentContentToLanguageKeep.csv
117 */
118 public function copyParentContentToLanguageInKeepMode()
119 {
120 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'keep';
121 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
122 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
123 $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
124 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
125 }
126
127 /**
128 * @see DataSet/copyParentContentToLanguageWAllChildrenKeep.csv
129 */
130 public function copyParentContentToLanguageWithAllChildrenInKeepMode()
131 {
132 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'keep';
133 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
134 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
135 $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
136 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
137 }
138
139 /**
140 * @see DataSet/copyParentContentToLanguageSelect.csv
141 */
142 public function copyParentContentToLanguageInSelectMode()
143 {
144 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
145 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
146 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
147 $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
148 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
149 }
150
151 /**
152 * @see DataSet/copyParentContentToLanguageWAllChildrenSelect.csv
153 */
154 public function copyParentContentToLanguageWithAllChildrenInSelectMode()
155 {
156 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
157 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
158 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
159 $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
160 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
161 }
162
163 /**
164 * @see DataSet/localizeParentContentKeep.csv
165 */
166 public function localizeParentContentInKeepMode()
167 {
168 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'keep';
169 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
170 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
171 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
172 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
173 }
174
175 /**
176 * @see DataSet/localizeParentContentWAllChildrenKeep.csv
177 */
178 public function localizeParentContentWithAllChildrenInKeepMode()
179 {
180 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'keep';
181 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
182 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
183 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
184 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
185 }
186
187 /**
188 * @see DataSet/localizeParentContentSelect.csv
189 */
190 public function localizeParentContentInSelectMode()
191 {
192 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
193 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
194 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
195 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
196 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
197 }
198
199 /**
200 * @see DataSet/localizeParentContentSelectWSynchronization.csv
201 */
202 public function localizeParentContentInSelectModeWithLanguageSynchronization()
203 {
204 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
205 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
206 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
207 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
208 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
209 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
210 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
211 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
212 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
213 }
214
215 /**
216 * @see DataSet/localizeParentContentWAllChildrenSelect.csv
217 */
218 public function localizeParentContentWithAllChildrenInSelectMode()
219 {
220 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
221 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
222 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
223 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
224 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
225 }
226
227 /**
228 * @see DataSet/localizeParentContentWAllChildrenSelect.csv
229 */
230 public function localizeParentContentWithAllChildrenInSelectModeAndLanguageSynchronization()
231 {
232 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
233 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
234 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
235 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
236 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
237 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
238 $this->actionService->modifyRecords(
239 self::VALUE_PageId,
240 [
241 self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
242 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
243 ]
244 );
245 }
246
247 /**
248 * @see DataSet/localizeParentContentWAllChildrenSelect.csv
249 */
250 public function localizeParentContentChainWithAllChildrenInSelectModeAndLanguageSynchronizationSource()
251 {
252 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
253 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
254 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
255 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
256 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
257 $this->recordIds['localizedContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
258 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['localizedContentIdFirst'], self::VALUE_LanguageIdSecond);
259 $this->recordIds['localizedContentIdSecond'] = $newTableIds[self::TABLE_Content][$this->recordIds['localizedContentIdFirst']];
260 $this->actionService->modifyRecord(
261 self::TABLE_Content,
262 $this->recordIds['localizedContentIdSecond'],
263 ['l10n_state' => [self::FIELD_ContentHotel => 'source']]
264 );
265 $this->actionService->modifyRecords(
266 self::VALUE_PageId,
267 [
268 self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
269 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
270 ]
271 );
272 }
273
274 /**
275 * @see DataSet/Modify/localizeParentContentNCreateNestedChildrenWLanguageSynchronization.csv
276 */
277 public function localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization()
278 {
279 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
280 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
281 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
282
283 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
284 $this->recordIds['localizedContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
285
286 $newHotelId = StringUtility::getUniqueId('NEW');
287 $newOfferId = StringUtility::getUniqueId('NEW');
288 $newPriceId = StringUtility::getUniqueId('NEW');
289 $dataMap = [
290 self::TABLE_Content => [
291 self::VALUE_ContentIdLast => [self::FIELD_ContentHotel => '5,' . $newHotelId],
292 ],
293 self::TABLE_Hotel => [
294 $newHotelId => ['pid' => self::VALUE_PageId, 'title' => 'New Hotel #1', 'offers' => $newOfferId],
295 ],
296 self::TABLE_Offer => [
297 $newOfferId => ['pid' => self::VALUE_PageId, 'title' => 'New Offer #1.1', 'prices' => $newPriceId],
298 ],
299 self::TABLE_Price => [
300 $newPriceId => ['pid' => self::VALUE_PageId, 'title' => 'New Price #1.1.1'],
301 ],
302 ];
303 $this->actionService->invoke($dataMap, []);
304 $this->recordIds['newHoteId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newHotelId];
305 $this->recordIds['newOfferId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newOfferId];
306 $this->recordIds['newPriceId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newPriceId];
307 }
308
309 /**
310 * @see DataSet/changeParentContentRecordSorting.csv
311 */
312 public function changeParentContentSorting()
313 {
314 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
315 }
316
317 /**
318 * @see DataSet/moveParentContentRecordToDifferentPage.csv
319 */
320 public function moveParentContentToDifferentPage()
321 {
322 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
323 }
324
325 /**
326 * @see DataSet/moveParentContentRecordToDifferentPageAndChangeSorting.csv
327 */
328 public function moveParentContentToDifferentPageAndChangeSorting()
329 {
330 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
331 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
332 }
333
334 /**
335 * Page records
336 */
337
338 /**
339 * @see DataSet/modifyPageRecord.csv
340 */
341 public function modifyPage()
342 {
343 $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1']);
344 }
345
346 /**
347 * @see DataSet/deletePageRecord.csv
348 */
349 public function deletePage()
350 {
351 $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
352 }
353
354 /**
355 * @see DataSet/copyPageRecord.csv
356 */
357 public function copyPage()
358 {
359 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
360 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
361 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
362 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
363 }
364
365 /**
366 * @see DataSet/copyPageWHotelBeforeParentContent.csv
367 */
368 public function copyPageWithHotelBeforeParentContent()
369 {
370 // Ensure hotels get processed first
371 $GLOBALS['TCA'] = array_merge(
372 [self::TABLE_Hotel => $GLOBALS['TCA'][self::TABLE_Hotel]],
373 $GLOBALS['TCA']
374 );
375
376 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
377 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
378 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
379 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
380 }
381
382 /**
383 * IRRE Child Records
384 */
385
386 /**
387 * @see DataSet/createParentContentRecordWithHotelAndOfferChildRecords.csv
388 */
389 public function createParentContentWithHotelAndOfferChildren()
390 {
391 $newTableIds = $this->actionService->createNewRecords(
392 self::VALUE_PageId,
393 [
394 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
395 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
396 self::TABLE_Offer => ['title' => 'Offer #1'],
397 ]
398 );
399 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
400 }
401
402 /**
403 * @see DataSet/createAndCopyParentContentRecordWithHotelAndOfferChildRecords.csv
404 */
405 public function createAndCopyParentContentWithHotelAndOfferChildren()
406 {
407 $newTableIds = $this->actionService->createNewRecords(
408 self::VALUE_PageId,
409 [
410 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
411 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
412 self::TABLE_Offer => ['title' => 'Offer #1'],
413 ]
414 );
415 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
416 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
417 $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
418 $this->recordIds['copiedContentId'] = $copiedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
419 $this->recordIds['copiedHotelId'] = $copiedTableIds[self::TABLE_Hotel][$this->recordIds['newHotelId']];
420 }
421
422 /**
423 * @see DataSet/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
424 */
425 public function createAndLocalizeParentContentWithHotelAndOfferChildren()
426 {
427 $newTableIds = $this->actionService->createNewRecords(
428 self::VALUE_PageId,
429 [
430 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
431 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
432 self::TABLE_Offer => ['title' => 'Offer #1'],
433 ]
434 );
435 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
436 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
437 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
438 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
439 }
440
441 /**
442 * @see DataSet/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
443 */
444 public function createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration()
445 {
446 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['sortby']);
447 $newTableIds = $this->actionService->createNewRecords(
448 self::VALUE_PageId,
449 [
450 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
451 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
452 self::TABLE_Offer => ['title' => 'Offer #1'],
453 ]
454 );
455 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
456 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
457 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
458 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
459 }
460
461 /**
462 * @see DataSet/modifyOnlyHotelChildRecord.csv
463 */
464 public function modifyOnlyHotelChild()
465 {
466 $this->actionService->modifyRecord(self::TABLE_Hotel, 4, ['title' => 'Testing #1']);
467 }
468
469 /**
470 * @see DataSet/modifyParentRecordAndChangeHotelChildRecordsSorting.csv
471 */
472 public function modifyParentAndChangeHotelChildrenSorting()
473 {
474 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, [self::FIELD_ContentHotel => '4,3']);
475 }
476
477 /**
478 * @see DataSet/modifyParentRecordWithHotelChildRecord.csv
479 */
480 public function modifyParentWithHotelChild()
481 {
482 $this->actionService->modifyRecords(
483 self::VALUE_PageId,
484 [
485 self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'],
486 self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
487 ]
488 );
489 }
490
491 /**
492 * @see DataSet/modifyParentRecordAndAddHotelChildRecord.csv
493 */
494 public function modifyParentAndAddHotelChild()
495 {
496 $this->actionService->modifyRecords(
497 self::VALUE_PageId,
498 [
499 self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
500 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
501 ]
502 );
503 }
504
505 /**
506 * @see DataSet/modifyParentRecordAndDeleteHotelChildRecord.csv
507 */
508 public function modifyParentAndDeleteHotelChild()
509 {
510 $this->actionService->modifyRecord(
511 self::TABLE_Content,
512 self::VALUE_ContentIdFirst,
513 [self::FIELD_ContentHotel => '3'],
514 [self::TABLE_Hotel => [4]]
515 );
516 }
517
518 public function localizePageWithLocalizationExclude()
519 {
520 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
521 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
522 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
523 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
524 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
525 }
526
527 public function localizePageAndAddHotelChildWithLocalizationExclude()
528 {
529 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
530 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
531 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
532 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
533 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
534 $this->actionService->modifyRecords(
535 self::VALUE_PageId,
536 [
537 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
538 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
539 ]
540 );
541 }
542
543 public function localizePageWithLanguageSynchronization()
544 {
545 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
546 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
547 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
548 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
549 }
550
551 public function localizePageAndAddHotelChildWithLanguageSynchronization()
552 {
553 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
554 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
555 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
556 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
557 $this->actionService->modifyRecords(
558 self::VALUE_PageId,
559 [
560 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
561 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
562 ]
563 );
564 }
565
566 public function localizePageAndAddMonoglotHotelChildWithLanguageSynchronization()
567 {
568 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['languageField']);
569 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['transOrigPointerField']);
570 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
571 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
572 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
573 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
574 $this->actionService->modifyRecords(
575 self::VALUE_PageId,
576 [
577 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
578 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
579 ]
580 );
581 }
582
583 public function localizeAndCopyPageWithLanguageSynchronization()
584 {
585 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
586 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
587 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
588 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
589 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
590 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
591 }
592 }