d272f4073733c794c7d2e28d1b4c362f63571739
[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_OfferIdLast = 8;
33 const VALUE_LanguageId = 1;
34 const VALUE_LanguageIdSecond = 2;
35
36 const TABLE_Page = 'pages';
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.typoscript',
62 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/ExtbaseJsonRenderer.typoscript',
63 ]
64 );
65 }
66
67 /**
68 * Parent content records
69 */
70
71 /**
72 * @see DataSet/createParentContentRecord.csv
73 */
74 public function createParentContent()
75 {
76 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
77 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
78 }
79
80 /**
81 * @see DataSet/modifyParentContentRecord.csv
82 */
83 public function modifyParentContent()
84 {
85 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, ['header' => 'Testing #1']);
86 }
87
88 /**
89 * @see DataSet/deleteParentContentRecord.csv
90 */
91 public function deleteParentContent()
92 {
93 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
94 }
95
96 /**
97 * @see DataSet/copyParentContentRecord.csv
98 */
99 public function copyParentContent()
100 {
101 $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
102 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
103 }
104
105 /**
106 * @see DataSet/copyParentContentToDifferentPage.csv
107 */
108 public function copyParentContentToDifferentPage()
109 {
110 $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
111 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
112 }
113
114 /**
115 * @see DataSet/localizeParentContentSynchronization.csv
116 */
117 public function localizeParentContentWithLanguageSynchronization()
118 {
119 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
120 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
121 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
122 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
123 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
124 }
125
126 /**
127 * @see DataSet/localizeParentContentWAllChildrenSelect.csv
128 */
129 public function localizeParentContentChainLanguageSynchronizationSource()
130 {
131 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
132 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
133 $this->recordIds['localizedContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
134 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['localizedContentIdFirst'], self::VALUE_LanguageIdSecond);
135 $this->recordIds['localizedContentIdSecond'] = $newTableIds[self::TABLE_Content][$this->recordIds['localizedContentIdFirst']];
136 $this->actionService->modifyRecord(
137 self::TABLE_Content,
138 $this->recordIds['localizedContentIdSecond'],
139 ['l10n_state' => [self::FIELD_ContentHotel => 'source']]
140 );
141 $this->actionService->modifyRecords(
142 self::VALUE_PageId,
143 [
144 self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
145 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
146 ]
147 );
148 }
149
150 /**
151 * @see DataSet/copyParentContentToLanguageWAllChildren.csv
152 */
153 public function copyParentContentToLanguageWithAllChildren()
154 {
155 $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
156 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
157 }
158
159 /**
160 * @see DataSet/localizeParentContentWAllChildren.csv
161 */
162 public function localizeParentContentWithAllChildren()
163 {
164 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
165 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
166 }
167
168 /**
169 * @see DataSet/Modify/localizeParentContentNCreateNestedChildrenWLanguageSynchronization.csv
170 */
171 public function localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization()
172 {
173 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
174 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
175 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
176
177 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
178 $this->recordIds['localizedContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
179
180 $newHotelId = StringUtility::getUniqueId('NEW');
181 $newOfferId = StringUtility::getUniqueId('NEW');
182 $newPriceId = StringUtility::getUniqueId('NEW');
183 $dataMap = [
184 self::TABLE_Content => [
185 self::VALUE_ContentIdLast => [self::FIELD_ContentHotel => '5,' . $newHotelId],
186 ],
187 self::TABLE_Hotel => [
188 $newHotelId => ['pid' => self::VALUE_PageId, 'title' => 'New Hotel #1', 'offers' => $newOfferId],
189 ],
190 self::TABLE_Offer => [
191 $newOfferId => ['pid' => self::VALUE_PageId, 'title' => 'New Offer #1.1', 'prices' => $newPriceId],
192 ],
193 self::TABLE_Price => [
194 $newPriceId => ['pid' => self::VALUE_PageId, 'title' => 'New Price #1.1.1'],
195 ],
196 ];
197 $this->actionService->invoke($dataMap, []);
198 $this->recordIds['newHoteId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newHotelId];
199 $this->recordIds['newOfferId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newOfferId];
200 $this->recordIds['newPriceId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newPriceId];
201 }
202
203 /**
204 * @see DataSet/localizeParentContentSynchronization.csv
205 */
206 public function localizeParentContentAndSetInvalidChildReferenceWithLanguageSynchronization()
207 {
208 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
209 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
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 // modify IRRE relation value of localized record (which should be sanitized and filtered)
214 $this->actionService->modifyRecord(self::TABLE_Content, $this->recordIds['localizedContentId'], [self::FIELD_ContentHotel => '0']);
215 }
216
217 /**
218 * @see DataSet/localizeParentContentSynchronization.csv
219 */
220 public function localizeParentContentAndSetInvalidChildReferenceWithLateLanguageSynchronization()
221 {
222 // disable language synchronization
223 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = false;
224 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = false;
225 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = false;
226 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
227 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
228 $this->recordIds['localizedHotelId'] = $newTableIds[self::TABLE_Hotel][self::VALUE_HotelIdThird];
229 $this->recordIds['localizedOfferId'] = $newTableIds[self::TABLE_Offer][self::VALUE_OfferIdLast];
230 // now enable language synchronization
231 $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
232 $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
233 $GLOBALS['TCA'][self::TABLE_Offer]['columns'][self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
234 // modify IRRE relation values of localized records (which should be sanitized and filtered)
235 $this->actionService->modifyRecords(
236 self::VALUE_PageId,
237 [
238 self::TABLE_Content => ['uid' => $this->recordIds['localizedContentId'], self::FIELD_ContentHotel => '0'],
239 self::TABLE_Hotel => ['uid' => $this->recordIds['localizedHotelId'], self::FIELD_ContentHotel => '0'],
240 self::TABLE_Offer => ['uid' => $this->recordIds['localizedOfferId'], self::FIELD_ContentHotel => '0'],
241 ]
242 );
243 }
244
245 /**
246 * @see DataSet/changeParentContentRecordSorting.csv
247 */
248 public function changeParentContentSorting()
249 {
250 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
251 }
252
253 /**
254 * @see DataSet/moveParentContentRecordToDifferentPage.csv
255 */
256 public function moveParentContentToDifferentPage()
257 {
258 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
259 }
260
261 /**
262 * @see DataSet/moveParentContentRecordToDifferentPageAndChangeSorting.csv
263 */
264 public function moveParentContentToDifferentPageAndChangeSorting()
265 {
266 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
267 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
268 }
269
270 /**
271 * Page records
272 */
273
274 /**
275 * @see DataSet/modifyPageRecord.csv
276 */
277 public function modifyPage()
278 {
279 $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1']);
280 }
281
282 /**
283 * @see DataSet/deletePageRecord.csv
284 */
285 public function deletePage()
286 {
287 $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
288 }
289
290 /**
291 * @see DataSet/copyPageRecord.csv
292 */
293 public function copyPage()
294 {
295 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
296 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
297 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
298 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
299 }
300
301 /**
302 * @see DataSet/copyPageWHotelBeforeParentContent.csv
303 */
304 public function copyPageWithHotelBeforeParentContent()
305 {
306 // Ensure hotels get processed first
307 $GLOBALS['TCA'] = array_merge(
308 [self::TABLE_Hotel => $GLOBALS['TCA'][self::TABLE_Hotel]],
309 $GLOBALS['TCA']
310 );
311
312 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
313 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
314 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
315 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
316 }
317
318 /**
319 * IRRE Child Records
320 */
321
322 /**
323 * @see DataSet/createParentContentRecordWithHotelAndOfferChildRecords.csv
324 */
325 public function createParentContentWithHotelAndOfferChildren()
326 {
327 $newTableIds = $this->actionService->createNewRecords(
328 self::VALUE_PageId,
329 [
330 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
331 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
332 self::TABLE_Offer => ['title' => 'Offer #1'],
333 ]
334 );
335 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
336 }
337
338 /**
339 * @see DataSet/createAndCopyParentContentRecordWithHotelAndOfferChildRecords.csv
340 */
341 public function createAndCopyParentContentWithHotelAndOfferChildren()
342 {
343 $newTableIds = $this->actionService->createNewRecords(
344 self::VALUE_PageId,
345 [
346 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
347 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
348 self::TABLE_Offer => ['title' => 'Offer #1'],
349 ]
350 );
351 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
352 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
353 $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
354 $this->recordIds['copiedContentId'] = $copiedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
355 $this->recordIds['copiedHotelId'] = $copiedTableIds[self::TABLE_Hotel][$this->recordIds['newHotelId']];
356 }
357
358 /**
359 * @see DataSet/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
360 */
361 public function createAndLocalizeParentContentWithHotelAndOfferChildren()
362 {
363 $newTableIds = $this->actionService->createNewRecords(
364 self::VALUE_PageId,
365 [
366 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
367 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
368 self::TABLE_Offer => ['title' => 'Offer #1'],
369 ]
370 );
371 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
372 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
373 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
374 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
375 }
376
377 /**
378 * @see DataSet/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
379 */
380 public function createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration()
381 {
382 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['sortby']);
383 $newTableIds = $this->actionService->createNewRecords(
384 self::VALUE_PageId,
385 [
386 self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
387 self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
388 self::TABLE_Offer => ['title' => 'Offer #1'],
389 ]
390 );
391 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
392 $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
393 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
394 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
395 }
396
397 /**
398 * @see DataSet/modifyOnlyHotelChildRecord.csv
399 */
400 public function modifyOnlyHotelChild()
401 {
402 $this->actionService->modifyRecord(self::TABLE_Hotel, 4, ['title' => 'Testing #1']);
403 }
404
405 /**
406 * @see DataSet/modifyParentRecordAndChangeHotelChildRecordsSorting.csv
407 */
408 public function modifyParentAndChangeHotelChildrenSorting()
409 {
410 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, [self::FIELD_ContentHotel => '4,3']);
411 }
412
413 /**
414 * @see DataSet/modifyParentRecordWithHotelChildRecord.csv
415 */
416 public function modifyParentWithHotelChild()
417 {
418 $this->actionService->modifyRecords(
419 self::VALUE_PageId,
420 [
421 self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'],
422 self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
423 ]
424 );
425 }
426
427 /**
428 * @see DataSet/modifyParentRecordAndAddHotelChildRecord.csv
429 */
430 public function modifyParentAndAddHotelChild()
431 {
432 $this->actionService->modifyRecords(
433 self::VALUE_PageId,
434 [
435 self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
436 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
437 ]
438 );
439 }
440
441 /**
442 * @see DataSet/modifyParentRecordAndDeleteHotelChildRecord.csv
443 */
444 public function modifyParentAndDeleteHotelChild()
445 {
446 $this->actionService->modifyRecord(
447 self::TABLE_Content,
448 self::VALUE_ContentIdFirst,
449 [self::FIELD_ContentHotel => '3'],
450 [self::TABLE_Hotel => [4]]
451 );
452 }
453
454 public function localizePageWithLocalizationExclude()
455 {
456 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
457 // in these test cases we expect new pages not to be hidden in order to
458 // verify proper overlaying behavior during the frontend render process
459 $GLOBALS['TCA'][self::TABLE_Page]['columns']['hidden']['config']['default'] = 0;
460 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
461 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
462 }
463
464 public function localizePageTwiceWithLocalizationExclude()
465 {
466 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
467 // in these test cases we expect new pages not to be hidden in order to
468 // verify proper overlaying behavior during the frontend render process
469 $GLOBALS['TCA'][self::TABLE_Page]['columns']['hidden']['config']['default'] = 0;
470 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
471 $this->recordIds['localizedPageIdFirst'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
472 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageIdSecond);
473 $this->recordIds['localizedPageIdSecond'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
474 }
475
476 public function localizePageAndAddHotelChildWithLocalizationExclude()
477 {
478 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
479 // in these test cases we expect new pages not to be hidden in order to
480 // verify proper overlaying behavior during the frontend render process
481 $GLOBALS['TCA'][self::TABLE_Page]['columns']['hidden']['config']['default'] = 0;
482 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
483 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
484 $this->actionService->modifyRecords(
485 self::VALUE_PageId,
486 [
487 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
488 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
489 ]
490 );
491 }
492
493 public function localizePageWithLanguageSynchronization()
494 {
495 // in these test cases we expect new pages not to be hidden in order to
496 // verify proper overlaying behavior during the frontend render process
497 $GLOBALS['TCA'][self::TABLE_Page]['columns']['hidden']['config']['default'] = 0;
498 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
499 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
500 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
501 }
502
503 public function localizePageAndAddHotelChildWithLanguageSynchronization()
504 {
505 // in these test cases we expect new pages not to be hidden in order to
506 // verify proper overlaying behavior during the frontend render process
507 $GLOBALS['TCA'][self::TABLE_Page]['columns']['hidden']['config']['default'] = 0;
508 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
509 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
510 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
511 $this->actionService->modifyRecords(
512 self::VALUE_PageId,
513 [
514 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
515 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
516 ]
517 );
518 }
519
520 public function localizePageAndAddMonoglotHotelChildWithLanguageSynchronization()
521 {
522 // in these test cases we expect new pages not to be hidden in order to
523 // verify proper overlaying behavior during the frontend render process
524 $GLOBALS['TCA'][self::TABLE_Page]['columns']['hidden']['config']['default'] = 0;
525 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['languageField']);
526 unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['transOrigPointerField']);
527 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
528 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
529 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
530 $this->actionService->modifyRecords(
531 self::VALUE_PageId,
532 [
533 self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
534 self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
535 ]
536 );
537 }
538
539 public function localizeAndCopyPageWithLanguageSynchronization()
540 {
541 // in these test cases we expect new pages not to be hidden in order to
542 // verify proper overlaying behavior during the frontend render process
543 $GLOBALS['TCA'][self::TABLE_Page]['columns']['hidden']['config']['default'] = 0;
544 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
545 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
546 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
547 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
548 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
549 }
550
551 public function localizePageWithSynchronizationAndCustomLocalizedHotel()
552 {
553 // in these test cases we expect new pages not to be hidden in order to
554 // verify proper overlaying behavior during the frontend render process
555 $GLOBALS['TCA'][self::TABLE_Page]['columns']['hidden']['config']['default'] = 0;
556 $GLOBALS['TCA'][self::TABLE_Page]['columns'][self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
557 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
558 $this->recordIds['localizedPageId'] = $localizedTableIds[self::TABLE_Page][self::VALUE_PageId];
559 // Using "localized page ID" on purpose because BE editing uses a "page" record and data handler
560 $this->actionService->modifyRecords(
561 $this->recordIds['localizedPageId'],
562 [
563 self::TABLE_Page => ['uid' => $this->recordIds['localizedPageId'], self::FIELD_PageHotel => '6,__nextUid', 'l10n_state' => [self::FIELD_PageHotel => 'custom']],
564 self::TABLE_Hotel => ['uid' => '__NEW', 'sys_language_uid' => self::VALUE_LanguageId, 'title' => 'Hotel in dansk page only'],
565 ]
566 );
567 }
568 }