‪TYPO3CMS  ‪main
AbstractActionTestCase.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 
25 {
27 
28  protected const ‪VALUE_PageId = 89;
29  protected const ‪VALUE_PageIdTarget = 90;
30  protected const ‪VALUE_PageIdWebsite = 1;
31  protected const ‪VALUE_ContentIdFirst = 297;
32  protected const ‪VALUE_ContentIdLast = 298;
33  protected const ‪VALUE_HotelIdFirst = 3;
34  protected const ‪VALUE_HotelIdSecond = 4;
35  protected const ‪VALUE_HotelIdThird = 5;
36  protected const ‪VALUE_OfferIdLast = 8;
37  protected const ‪VALUE_LanguageId = 1;
38  protected const ‪VALUE_LanguageIdSecond = 2;
39 
40  protected const ‪TABLE_Page = 'pages';
41  protected const ‪TABLE_Content = 'tt_content';
42  protected const ‪TABLE_Hotel = 'tx_testirreforeignfield_hotel';
43  protected const ‪TABLE_Offer = 'tx_testirreforeignfield_offer';
44  protected const ‪TABLE_Price = 'tx_testirreforeignfield_price';
45 
46  protected const ‪FIELD_PageHotel = 'tx_testirreforeignfield_hotels';
47  protected const ‪FIELD_ContentHotel = 'tx_testirreforeignfield_hotels';
48  protected const ‪FIELD_HotelOffer = 'offers';
49  protected const ‪FIELD_OfferPrice = 'prices';
50 
51  protected const ‪SCENARIO_DataSet = __DIR__ . '/DataSet/ImportDefault.csv';
52 
53  protected array ‪$testExtensionsToLoad = [
54  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield',
55  ];
56 
57  protected function ‪setUp(): void
58  {
59  parent::setUp();
60  $this->importCSVDataSet(static::SCENARIO_DataSet);
62  'test',
63  $this->‪buildSiteConfiguration(1, '/'),
64  [
65  $this->‪buildDefaultLanguageConfiguration('EN', '/'),
66  $this->‪buildLanguageConfiguration('DA', '/da/', ['EN']),
67  $this->‪buildLanguageConfiguration('DE', '/de/', ['DA', 'EN']),
68  ]
69  );
70  $this->setUpFrontendRootPage(
71  1,
72  [
73  'EXT:core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield/Configuration/TypoScript/JsonRenderer.typoscript',
74  'EXT:core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield/Configuration/TypoScript/ExtbaseJsonRenderer.typoscript',
75  ]
76  );
77  }
78 
86  public function ‪createParentContent(): void
87  {
88  $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
89  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
90  }
91 
92  public function ‪modifyParentContent(): void
93  {
94  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, ['header' => 'Testing #1']);
95  }
96 
97  public function ‪deleteParentContent(): void
98  {
99  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
100  }
101 
102  public function ‪copyParentContent(): void
103  {
104  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
105  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
106  }
107 
108  public function ‪copyParentContentToDifferentPage(): void
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 
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 
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 
153  public function ‪copyParentContentToLanguageWithAllChildren(): void
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  public function ‪localizeParentContentWithAllChildren(): void
160  {
161  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
162  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
163  }
164 
169  {
170  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
171  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
172  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
173 
174  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
175  $this->recordIds['localizedContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
176 
177  $newHotelId = ‪StringUtility::getUniqueId('NEW');
178  $newOfferId = ‪StringUtility::getUniqueId('NEW');
179  $newPriceId = ‪StringUtility::getUniqueId('NEW');
180  $dataMap = [
181  self::TABLE_Content => [
182  self::VALUE_ContentIdLast => [self::FIELD_ContentHotel => '5,' . $newHotelId],
183  ],
184  self::TABLE_Hotel => [
185  $newHotelId => ['pid' => ‪self::VALUE_PageId, 'title' => 'New Hotel #1', 'offers' => $newOfferId],
186  ],
187  self::TABLE_Offer => [
188  $newOfferId => ['pid' => ‪self::VALUE_PageId, 'title' => 'New Offer #1.1', 'prices' => $newPriceId],
189  ],
190  self::TABLE_Price => [
191  $newPriceId => ['pid' => ‪self::VALUE_PageId, 'title' => 'New Price #1.1.1'],
192  ],
193  ];
194  $this->actionService->invoke($dataMap, []);
195  $this->recordIds['newHoteId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newHotelId];
196  $this->recordIds['newOfferId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newOfferId];
197  $this->recordIds['newPriceId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newPriceId];
198  }
199 
204  {
205  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
206  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
207  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
208  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
209  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
210  // modify IRRE relation value of localized record (which should be sanitized and filtered)
211  $this->actionService->modifyRecord(self::TABLE_Content, $this->recordIds['localizedContentId'], [self::FIELD_ContentHotel => '0']);
212  }
213 
218  {
219  // disable language synchronization
220  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = false;
221  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = false;
222  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = false;
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  $this->recordIds['localizedHotelId'] = $newTableIds[‪self::TABLE_Hotel][‪self::VALUE_HotelIdThird];
226  $this->recordIds['localizedOfferId'] = $newTableIds[‪self::TABLE_Offer][‪self::VALUE_OfferIdLast];
227  // now enable language synchronization
228  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
229  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
230  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
231  // modify IRRE relation values of localized records (which should be sanitized and filtered)
232  $this->actionService->modifyRecords(
233  self::VALUE_PageId,
234  [
235  self::TABLE_Content => ['uid' => $this->recordIds['localizedContentId'], self::FIELD_ContentHotel => '0'],
236  self::TABLE_Hotel => ['uid' => $this->recordIds['localizedHotelId'], self::FIELD_ContentHotel => '0'],
237  self::TABLE_Offer => ['uid' => $this->recordIds['localizedOfferId'], self::FIELD_ContentHotel => '0'],
238  ]
239  );
240  }
241 
242  public function ‪changeParentContentSorting(): void
243  {
244  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
245  }
246 
247  public function ‪moveParentContentToDifferentPage(): void
248  {
249  $newRecordIds = $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
250  // In workspaces new records are created and discard drops this one again, live creates no new record
251  if (isset($newRecordIds[self::TABLE_Content][self::VALUE_ContentIdLast])) {
252  $this->recordIds['newContentId'] = $newRecordIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
253  }
254  }
255 
256  public function ‪moveParentContentToDifferentPageTwice(): void
257  {
258  $newRecordIds = $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
259  $this->recordIds['newContentId'] = $newRecordIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
260  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdWebsite);
261  }
262 
264  {
265  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
266  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
267  }
268 
276  public function ‪modifyPage(): void
277  {
278  $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1']);
279  }
280 
281  public function ‪deletePage(): void
282  {
283  $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
284  }
285 
286  public function ‪copyPage(): void
287  {
288  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
289  $this->recordIds['newPageId'] = $newTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
290  $this->recordIds['newContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdFirst];
291  $this->recordIds['newContentIdLast'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
292  }
293 
294  public function ‪copyPageWithHotelBeforeParentContent(): void
295  {
296  // Ensure hotels get processed first
297  ‪$GLOBALS['TCA'] = array_merge(
298  [self::TABLE_Hotel => ‪$GLOBALS['TCA'][self::TABLE_Hotel]],
299  ‪$GLOBALS['TCA']
300  );
301 
302  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
303  $this->recordIds['newPageId'] = $newTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
304  $this->recordIds['newContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdFirst];
305  $this->recordIds['newContentIdLast'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
306  }
307 
316  {
317  $newTableIds = $this->actionService->createNewRecords(
318  self::VALUE_PageId,
319  [
320  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
321  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
322  self::TABLE_Offer => ['title' => 'Offer #1'],
323  ]
324  );
325  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
326  }
327 
329  {
330  $newTableIds = $this->actionService->createNewRecords(
331  self::VALUE_PageId,
332  [
333  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
334  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
335  self::TABLE_Offer => ['title' => 'Offer #1'],
336  ]
337  );
338  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
339  $this->recordIds['newHotelId'] = $newTableIds[‪self::TABLE_Hotel][0];
340  $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
341  $this->recordIds['copiedContentId'] = $copiedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
342  $this->recordIds['copiedHotelId'] = $copiedTableIds[‪self::TABLE_Hotel][$this->recordIds['newHotelId']];
343  }
344 
346  {
347  $newTableIds = $this->actionService->createNewRecords(
348  self::VALUE_PageId,
349  [
350  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
351  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
352  self::TABLE_Offer => ['title' => 'Offer #1'],
353  ]
354  );
355  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
356  $this->recordIds['newHotelId'] = $newTableIds[‪self::TABLE_Hotel][0];
357  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
358  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
359  }
360 
362  {
363  unset(‪$GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['sortby']);
364  $newTableIds = $this->actionService->createNewRecords(
365  self::VALUE_PageId,
366  [
367  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
368  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
369  self::TABLE_Offer => ['title' => 'Offer #1'],
370  ]
371  );
372  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
373  $this->recordIds['newHotelId'] = $newTableIds[‪self::TABLE_Hotel][0];
374  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
375  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
376  }
377 
378  public function ‪modifyOnlyHotelChild(): void
379  {
380  $this->actionService->modifyRecord(self::TABLE_Hotel, 4, ['title' => 'Testing #1']);
381  }
382 
383  public function ‪modifyParentAndChangeHotelChildrenSorting(): void
384  {
385  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, [self::FIELD_ContentHotel => '4,3']);
386  }
387 
388  public function ‪modifyParentWithHotelChild(): void
389  {
390  $this->actionService->modifyRecords(
391  self::VALUE_PageId,
392  [
393  self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'],
394  self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
395  ]
396  );
397  }
398 
399  public function ‪modifyParentAndAddHotelChild(): void
400  {
401  $this->actionService->modifyRecords(
402  self::VALUE_PageId,
403  [
404  self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
405  self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
406  ]
407  );
408  }
409 
410  public function ‪modifyParentAndDeleteHotelChild(): void
411  {
412  $this->actionService->modifyRecord(
413  self::TABLE_Content,
414  self::VALUE_ContentIdFirst,
415  [self::FIELD_ContentHotel => '3'],
416  [self::TABLE_Hotel => [4]]
417  );
418  }
419 
420  public function ‪localizePageWithLocalizationExclude(): void
421  {
422  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
423  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
424  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
425  }
426 
427  public function ‪localizePageTwiceWithLocalizationExclude(): void
428  {
429  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
430  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
431  $this->recordIds['localizedPageIdFirst'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
432  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageIdSecond);
433  $this->recordIds['localizedPageIdSecond'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
434  }
435 
437  {
438  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
439  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
440  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
441  $this->actionService->modifyRecords(
442  self::VALUE_PageId,
443  [
444  self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
445  self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
446  ]
447  );
448  }
449 
450  public function ‪localizePageWithLanguageSynchronization(): void
451  {
452  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
453  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
454  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
455  }
456 
458  {
459  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
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  $this->actionService->modifyRecords(
463  self::VALUE_PageId,
464  [
465  self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
466  self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
467  ]
468  );
469  }
470 
472  {
473  unset(‪$GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['languageField']);
474  unset(‪$GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['transOrigPointerField']);
475  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
476  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
477  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪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 
488  {
489  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['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  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
493  $this->recordIds['newPageId'] = $newTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
494  }
495 
497  {
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  // Using "localized page ID" on purpose because BE editing uses a "page" record and data handler
502  $this->actionService->modifyRecords(
503  $this->recordIds['localizedPageId'],
504  [
505  self::TABLE_Page => ['uid' => $this->recordIds['localizedPageId'], self::FIELD_PageHotel => '6,__nextUid', 'l10n_state' => [self::FIELD_PageHotel => 'custom']],
506  self::TABLE_Hotel => ['uid' => '__NEW', 'sys_language_uid' => self::VALUE_LanguageId, 'title' => 'Hotel in dansk page only'],
507  ]
508  );
509  }
510 
511  public function ‪inlineLocalizeSynchronizeLocalizeMissing(): void
512  {
513  // Translate page 89 first
514  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
515  // Localize CE 297 which has two hotels, those are localized, too.
516  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, self::VALUE_LanguageId);
517  $this->recordIds['localizedContentId'] = $newTableIds['tt_content'][‪self::VALUE_ContentIdFirst];
518  $this->recordIds['localizedHotelId'] = $newTableIds['tx_testirreforeignfield_hotel'][‪self::VALUE_HotelIdFirst];
519  // Delete one localized hotel (and its children) again.
520  // We end up with having one localized hotel child and a missing one, while both exist in default language.
521  $this->actionService->deleteRecord('tx_testirreforeignfield_hotel', $this->recordIds['localizedHotelId']);
522  // Now inlineLocalizeSynchronize->localize - This is the 'localize all records' button when inline
523  // 'appearance' 'showAllLocalizationLink' has been enabled. It should re-localize the missing hotel again.
524  $this->actionService->invoke(
525  [],
526  [
527  'tt_content' => [
528  $this->recordIds['localizedContentId'] => [
529  'inlineLocalizeSynchronize' => [
530  'field' => 'tx_testirreforeignfield_hotels',
531  'language' => 1,
532  'action' => 'localize',
533  ],
534  ],
535  ],
536  ]
537  );
538  }
539 }
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizeParentContentWithLanguageSynchronization
‪localizeParentContentWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:116
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:40
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildLanguageConfiguration
‪buildLanguageConfiguration(string $identifier, string $base, array $fallbackIdentifiers=[], string $fallbackType=null)
Definition: SiteBasedTestTrait.php:108
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\copyParentContentToLanguageWithAllChildren
‪copyParentContentToLanguageWithAllChildren()
Definition: AbstractActionTestCase.php:152
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:56
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\createParentContentWithHotelAndOfferChildren
‪createParentContentWithHotelAndOfferChildren()
Definition: AbstractActionTestCase.php:314
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\FIELD_HotelOffer
‪const FIELD_HotelOffer
Definition: AbstractActionTestCase.php:47
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\SCENARIO_DataSet
‪const SCENARIO_DataSet
Definition: AbstractActionTestCase.php:50
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizePageWithLanguageSynchronization
‪localizePageWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:449
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\moveParentContentToDifferentPage
‪moveParentContentToDifferentPage()
Definition: AbstractActionTestCase.php:246
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizePageWithSynchronizationAndCustomLocalizedHotel
‪localizePageWithSynchronizationAndCustomLocalizedHotel()
Definition: AbstractActionTestCase.php:495
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait
Definition: SiteBasedTestTrait.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\TABLE_Page
‪const TABLE_Page
Definition: AbstractActionTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\modifyOnlyHotelChild
‪modifyOnlyHotelChild()
Definition: AbstractActionTestCase.php:377
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizeParentContentAndSetInvalidChildReferenceWithLanguageSynchronization
‪localizeParentContentAndSetInvalidChildReferenceWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:202
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizeParentContentChainLanguageSynchronizationSource
‪localizeParentContentChainLanguageSynchronizationSource()
Definition: AbstractActionTestCase.php:128
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizePageWithLocalizationExclude
‪localizePageWithLocalizationExclude()
Definition: AbstractActionTestCase.php:419
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:50
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\FIELD_ContentHotel
‪const FIELD_ContentHotel
Definition: AbstractActionTestCase.php:46
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\createAndLocalizeParentContentWithHotelAndOfferChildren
‪createAndLocalizeParentContentWithHotelAndOfferChildren()
Definition: AbstractActionTestCase.php:344
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:88
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration
‪createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration()
Definition: AbstractActionTestCase.php:360
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\copyParentContentToDifferentPage
‪copyParentContentToDifferentPage()
Definition: AbstractActionTestCase.php:107
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_LanguageIdSecond
‪const VALUE_LanguageIdSecond
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\modifyParentAndDeleteHotelChild
‪modifyParentAndDeleteHotelChild()
Definition: AbstractActionTestCase.php:409
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\FIELD_PageHotel
‪const FIELD_PageHotel
Definition: AbstractActionTestCase.php:45
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_PageIdWebsite
‪const VALUE_PageIdWebsite
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\inlineLocalizeSynchronizeLocalizeMissing
‪inlineLocalizeSynchronizeLocalizeMissing()
Definition: AbstractActionTestCase.php:510
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_HotelIdFirst
‪const VALUE_HotelIdFirst
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\copyPage
‪copyPage()
Definition: AbstractActionTestCase.php:285
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizeAndCopyPageWithLanguageSynchronization
‪localizeAndCopyPageWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:486
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField
Definition: AbstractActionTestCase.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizePageTwiceWithLocalizationExclude
‪localizePageTwiceWithLocalizationExclude()
Definition: AbstractActionTestCase.php:426
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\copyPageWithHotelBeforeParentContent
‪copyPageWithHotelBeforeParentContent()
Definition: AbstractActionTestCase.php:293
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_HotelIdSecond
‪const VALUE_HotelIdSecond
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\TABLE_Offer
‪const TABLE_Offer
Definition: AbstractActionTestCase.php:42
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizeParentContentWithAllChildren
‪localizeParentContentWithAllChildren()
Definition: AbstractActionTestCase.php:158
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizeParentContentAndSetInvalidChildReferenceWithLateLanguageSynchronization
‪localizeParentContentAndSetInvalidChildReferenceWithLateLanguageSynchronization()
Definition: AbstractActionTestCase.php:216
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: AbstractActionTestCase.php:52
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\createParentContent
‪createParentContent()
Definition: AbstractActionTestCase.php:85
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_HotelIdThird
‪const VALUE_HotelIdThird
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\createAndCopyParentContentWithHotelAndOfferChildren
‪createAndCopyParentContentWithHotelAndOfferChildren()
Definition: AbstractActionTestCase.php:327
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\TABLE_Price
‪const TABLE_Price
Definition: AbstractActionTestCase.php:43
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration
‪buildDefaultLanguageConfiguration(string $identifier, string $base)
Definition: SiteBasedTestTrait.php:98
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\modifyParentAndChangeHotelChildrenSorting
‪modifyParentAndChangeHotelChildrenSorting()
Definition: AbstractActionTestCase.php:382
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\deletePage
‪deletePage()
Definition: AbstractActionTestCase.php:280
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\FIELD_OfferPrice
‪const FIELD_OfferPrice
Definition: AbstractActionTestCase.php:48
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\modifyParentWithHotelChild
‪modifyParentWithHotelChild()
Definition: AbstractActionTestCase.php:387
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\moveParentContentToDifferentPageAndChangeSorting
‪moveParentContentToDifferentPageAndChangeSorting()
Definition: AbstractActionTestCase.php:262
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\deleteParentContent
‪deleteParentContent()
Definition: AbstractActionTestCase.php:96
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\moveParentContentToDifferentPageTwice
‪moveParentContentToDifferentPageTwice()
Definition: AbstractActionTestCase.php:255
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization
‪localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:167
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizePageAndAddMonoglotHotelChildWithLanguageSynchronization
‪localizePageAndAddMonoglotHotelChildWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:470
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\modifyParentContent
‪modifyParentContent()
Definition: AbstractActionTestCase.php:91
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\TABLE_Hotel
‪const TABLE_Hotel
Definition: AbstractActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizePageAndAddHotelChildWithLanguageSynchronization
‪localizePageAndAddHotelChildWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:456
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\localizePageAndAddHotelChildWithLocalizationExclude
‪localizePageAndAddHotelChildWithLocalizationExclude()
Definition: AbstractActionTestCase.php:435
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\modifyPage
‪modifyPage()
Definition: AbstractActionTestCase.php:275
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_OfferIdLast
‪const VALUE_OfferIdLast
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\changeParentContentSorting
‪changeParentContentSorting()
Definition: AbstractActionTestCase.php:241
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\copyParentContent
‪copyParentContent()
Definition: AbstractActionTestCase.php:101
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase\modifyParentAndAddHotelChild
‪modifyParentAndAddHotelChild()
Definition: AbstractActionTestCase.php:398
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static getUniqueId(string $prefix='')
Definition: StringUtility.php:57
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase
Definition: AbstractActionTestCase.php:25