d29468bb17d309c3e057219ace3870594591183b
[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/localizeParentContentSynchronization.csv
117 */
118 public function localizeParentContentWithLanguageSynchronization()
119 {
120 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
121 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
122 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
123 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
124 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['localizeChildrenAtParentLocalization'] = false;
125 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
126 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
127 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
128 }
129
130 /**
131 * @see DataSet/localizeParentContentWAllChildrenSelect.csv
132 */
133 public function localizeParentContentChainLanguageSynchronizationSource()
134 {
135 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
136 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
137 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = true;
138 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
139 $this->recordIds['localizedContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
140 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['localizedContentIdFirst'], self::VALUE_LanguageIdSecond);
141 $this->recordIds['localizedContentIdSecond'] = $newTableIds[self::TABLE_Content][$this->recordIds['localizedContentIdFirst']];
142 $this->actionService->modifyRecord(
143 self::TABLE_Content,
144 $this->recordIds['localizedContentIdSecond'],
145 ['l10n_state' => [self::FIELD_ContentHotel => 'source']]
146 );
147 $this->actionService->modifyRecords(
148 self::VALUE_PageId,
149 [
150 self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
151 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
152 ]
153 );
154 }
155
156 /**
157 * @see DataSet/Modify/localizeParentContentNCreateNestedChildrenWLanguageSynchronization.csv
158 */
159 public function localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization()
160 {
161 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
162 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
163 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
164
165 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
166 $this->recordIds['localizedContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
167
168 $newHotelId = StringUtility::getUniqueId('NEW');
169 $newOfferId = StringUtility::getUniqueId('NEW');
170 $newPriceId = StringUtility::getUniqueId('NEW');
171 $dataMap = [
172 self::TABLE_Content => [
173 self::VALUE_ContentIdLast => [self::FIELD_ContentHotel => '5,' . $newHotelId],
174 ],
175 self::TABLE_Hotel => [
176 $newHotelId => ['pid' => self::VALUE_PageId, 'title' => 'New Hotel #1', 'offers' => $newOfferId],
177 ],
178 self::TABLE_Offer => [
179 $newOfferId => ['pid' => self::VALUE_PageId, 'title' => 'New Offer #1.1', 'prices' => $newPriceId],
180 ],
181 self::TABLE_Price => [
182 $newPriceId => ['pid' => self::VALUE_PageId, 'title' => 'New Price #1.1.1'],
183 ],
184 ];
185 $this->actionService->invoke($dataMap, []);
186 $this->recordIds['newHoteId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newHotelId];
187 $this->recordIds['newOfferId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newOfferId];
188 $this->recordIds['newPriceId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newPriceId];
189 }
190
191 public function localizeChildrenHavingStandaloneChildrenInSelectModeAndLanguageSynchronization()
192 {
193 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
194 unset($GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization']);
195 unset($GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization']);
196
197 $this->actionService->createNewRecords(self::VALUE_PageId, [
198 self::TABLE_Hotel => ['title' => 'Hotel Standalone', 'parenttable' => 'tt_content'],
199 self::TABLE_Offer => ['title' => 'Offer Standalone', 'parenttable' => 'tt_content'],
200 ]);
201
202 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
203 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
204 $this->actionService->modifyRecords(
205 self::VALUE_PageId,
206 [
207 self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
208 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
209 ]
210 );
211 }
212
213 /**
214 * @see DataSet/changeParentContentRecordSorting.csv
215 */
216 public function changeParentContentSorting()
217 {
218 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
219 }
220
221 /**
222 * @see DataSet/moveParentContentRecordToDifferentPage.csv
223 */
224 public function moveParentContentToDifferentPage()
225 {
226 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
227 }
228
229 /**
230 * @see DataSet/moveParentContentRecordToDifferentPageAndChangeSorting.csv
231 */
232 public function moveParentContentToDifferentPageAndChangeSorting()
233 {
234 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
235 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
236 }
237
238 /**
239 * Page records
240 */
241
242 /**
243 * @see DataSet/modifyPageRecord.csv
244 */
245 public function modifyPage()
246 {
247 $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1']);
248 }
249
250 /**
251 * @see DataSet/deletePageRecord.csv
252 */
253 public function deletePage()
254 {
255 $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
256 }
257
258 /**
259 * @see DataSet/copyPageRecord.csv
260 */
261 public function copyPage()
262 {
263 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
264 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
265 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
266 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
267 }
268
269 /**
270 * @see DataSet/copyPageWHotelBeforeParentContent.csv
271 */
272 public function copyPageWithHotelBeforeParentContent()
273 {
274 // Ensure hotels get processed first
275 $GLOBALS['TCA'] = array_merge(
276 [self::TABLE_Hotel => $GLOBALS['TCA'][self::TABLE_Hotel]],
277 $GLOBALS['TCA']
278 );
279
280 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
281 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
282 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
283 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
284 }
285
286 /**
287 * IRRE Child Records
288 */
289
290 /**
291 * @see DataSet/createParentContentRecordWithHotelAndOfferChildRecords.csv
292 */
293 public function createParentContentWithHotelAndOfferChildren()
294 {
295 $newTableIds = $this->actionService->createNewRecords(
296 self::VALUE_PageId,
297 [
298 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
299 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
300 self::TABLE_Offer => ['title' => 'Offer #1'],
301 ]
302 );
303 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
304 }
305
306 /**
307 * @see DataSet/createAndCopyParentContentRecordWithHotelAndOfferChildRecords.csv
308 */
309 public function createAndCopyParentContentWithHotelAndOfferChildren()
310 {
311 $newTableIds = $this->actionService->createNewRecords(
312 self::VALUE_PageId,
313 [
314 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
315 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
316 self::TABLE_Offer => ['title' => 'Offer #1'],
317 ]
318 );
319 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
320 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
321 $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
322 $this->recordIds['copiedContentId'] = $copiedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
323 $this->recordIds['copiedHotelId'] = $copiedTableIds[self::TABLE_Hotel][$this->recordIds['newHotelId']];
324 }
325
326 /**
327 * @see DataSet/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
328 */
329 public function createAndLocalizeParentContentWithHotelAndOfferChildren()
330 {
331 $newTableIds = $this->actionService->createNewRecords(
332 self::VALUE_PageId,
333 [
334 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
335 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
336 self::TABLE_Offer => ['title' => 'Offer #1'],
337 ]
338 );
339 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
340 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
341 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
342 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
343 }
344
345 /**
346 * @see DataSet/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
347 */
348 public function createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration()
349 {
350 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['sortby']);
351 $newTableIds = $this->actionService->createNewRecords(
352 self::VALUE_PageId,
353 [
354 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
355 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
356 self::TABLE_Offer => ['title' => 'Offer #1'],
357 ]
358 );
359 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
360 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
361 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
362 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
363 }
364
365 /**
366 * @see DataSet/modifyOnlyHotelChildRecord.csv
367 */
368 public function modifyOnlyHotelChild()
369 {
370 $this->actionService->modifyRecord(self::TABLE_Hotel, 4, ['title' => 'Testing #1']);
371 }
372
373 /**
374 * @see DataSet/modifyParentRecordAndChangeHotelChildRecordsSorting.csv
375 */
376 public function modifyParentAndChangeHotelChildrenSorting()
377 {
378 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, [self::FIELD_ContentHotel => '4,3']);
379 }
380
381 /**
382 * @see DataSet/modifyParentRecordWithHotelChildRecord.csv
383 */
384 public function modifyParentWithHotelChild()
385 {
386 $this->actionService->modifyRecords(
387 self::VALUE_PageId,
388 [
389 self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'],
390 self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
391 ]
392 );
393 }
394
395 /**
396 * @see DataSet/modifyParentRecordAndAddHotelChildRecord.csv
397 */
398 public function modifyParentAndAddHotelChild()
399 {
400 $this->actionService->modifyRecords(
401 self::VALUE_PageId,
402 [
403 self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
404 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
405 ]
406 );
407 }
408
409 /**
410 * @see DataSet/modifyParentRecordAndDeleteHotelChildRecord.csv
411 */
412 public function modifyParentAndDeleteHotelChild()
413 {
414 $this->actionService->modifyRecord(
415 self::TABLE_Content,
416 self::VALUE_ContentIdFirst,
417 [self::FIELD_ContentHotel => '3'],
418 [self::TABLE_Hotel => [4]]
419 );
420 }
421
422 public function localizePageWithLocalizationExclude()
423 {
424 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
425 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
426 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
427 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
428 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
429 }
430
431 public function localizePageAndAddHotelChildWithLocalizationExclude()
432 {
433 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
434 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
435 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
436 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
437 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
438 $this->actionService->modifyRecords(
439 self::VALUE_PageId,
440 [
441 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
442 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
443 ]
444 );
445 }
446
447 public function localizePageWithLanguageSynchronization()
448 {
449 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
450 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
451 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
452 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
453 }
454
455 public function localizePageAndAddHotelChildWithLanguageSynchronization()
456 {
457 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
458 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
459 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
460 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
461 $this->actionService->modifyRecords(
462 self::VALUE_PageId,
463 [
464 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
465 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
466 ]
467 );
468 }
469
470 public function localizePageAndAddMonoglotHotelChildWithLanguageSynchronization()
471 {
472 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['languageField']);
473 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['transOrigPointerField']);
474 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
475 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
476 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
477 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
478 $this->actionService->modifyRecords(
479 self::VALUE_PageId,
480 [
481 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
482 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
483 ]
484 );
485 }
486
487 public function localizeAndCopyPageWithLanguageSynchronization()
488 {
489 $GLOBALS['TCA'][self::TABLE_PageOverlay]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
490 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
491 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
492 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
493 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
494 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
495 }
496 }