‪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_testirreforeignfieldnonws_hotel';
43  protected const ‪TABLE_Offer = 'tx_testirreforeignfieldnonws_offer';
44  protected const ‪TABLE_Price = 'tx_testirreforeignfieldnonws_price';
45 
46  protected const ‪FIELD_PageHotel = 'tx_testirreforeignfieldnonws_hotels';
47  protected const ‪FIELD_ContentHotel = 'tx_testirreforeignfieldnonws_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_non_ws',
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  }
71 
79  public function ‪createParentContent(): void
80  {
81  $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
82  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
83  }
84 
85  public function ‪modifyParentContent(): void
86  {
87  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, ['header' => 'Testing #1']);
88  }
89 
90  public function ‪deleteParentContent(): void
91  {
92  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
93  }
94 
95  public function ‪copyParentContent(): void
96  {
97  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
98  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
99  }
100 
101  public function ‪copyParentContentToDifferentPage(): void
102  {
103  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
104  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
105  }
106 
111  {
112  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
113  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
114  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
115  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
116  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
117  }
118 
123  {
124  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
125  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
126  $this->recordIds['localizedContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
127  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['localizedContentIdFirst'], self::VALUE_LanguageIdSecond);
128  $this->recordIds['localizedContentIdSecond'] = $newTableIds[‪self::TABLE_Content][$this->recordIds['localizedContentIdFirst']];
129  $this->actionService->modifyRecord(
130  self::TABLE_Content,
131  $this->recordIds['localizedContentIdSecond'],
132  ['l10n_state' => [self::FIELD_ContentHotel => 'source']]
133  );
134  $this->actionService->modifyRecords(
135  self::VALUE_PageId,
136  [
137  self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
138  self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
139  ]
140  );
141  }
142 
146  public function ‪copyParentContentToLanguageWithAllChildren(): void
147  {
148  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
149  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
150  }
151 
152  public function ‪localizeParentContentWithAllChildren(): void
153  {
154  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
155  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
156  }
157 
162  {
163  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
164  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
165  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
166 
167  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
168  $this->recordIds['localizedContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
169 
170  $newHotelId = ‪StringUtility::getUniqueId('NEW');
171  $newOfferId = ‪StringUtility::getUniqueId('NEW');
172  $newPriceId = ‪StringUtility::getUniqueId('NEW');
173  $dataMap = [
174  self::TABLE_Content => [
175  self::VALUE_ContentIdLast => [self::FIELD_ContentHotel => '5,' . $newHotelId],
176  ],
177  self::TABLE_Hotel => [
178  $newHotelId => ['pid' => ‪self::VALUE_PageId, 'title' => 'New Hotel #1', 'offers' => $newOfferId],
179  ],
180  self::TABLE_Offer => [
181  $newOfferId => ['pid' => ‪self::VALUE_PageId, 'title' => 'New Offer #1.1', 'prices' => $newPriceId],
182  ],
183  self::TABLE_Price => [
184  $newPriceId => ['pid' => ‪self::VALUE_PageId, 'title' => 'New Price #1.1.1'],
185  ],
186  ];
187  $this->actionService->invoke($dataMap, []);
188  $this->recordIds['newHoteId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newHotelId];
189  $this->recordIds['newOfferId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newOfferId];
190  $this->recordIds['newPriceId'] = $this->actionService->getDataHandler()->substNEWwithIDs[$newPriceId];
191  }
192 
197  {
198  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
199  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
200  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
201  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
202  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
203  // modify IRRE relation value of localized record (which should be sanitized and filtered)
204  $this->actionService->modifyRecord(self::TABLE_Content, $this->recordIds['localizedContentId'], [self::FIELD_ContentHotel => '0']);
205  }
206 
211  {
212  // disable language synchronization
213  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = false;
214  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = false;
215  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = false;
216  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
217  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
218  $this->recordIds['localizedHotelId'] = $newTableIds[‪self::TABLE_Hotel][‪self::VALUE_HotelIdThird];
219  $this->recordIds['localizedOfferId'] = $newTableIds[‪self::TABLE_Offer][‪self::VALUE_OfferIdLast];
220  // now enable language synchronization
221  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_ContentHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
222  ‪$GLOBALS['TCA'][‪self::TABLE_Hotel]['columns'][‪self::FIELD_HotelOffer]['config']['behaviour']['allowLanguageSynchronization'] = true;
223  ‪$GLOBALS['TCA'][‪self::TABLE_Offer]['columns'][‪self::FIELD_OfferPrice]['config']['behaviour']['allowLanguageSynchronization'] = true;
224  // modify IRRE relation values of localized records (which should be sanitized and filtered)
225  $this->actionService->modifyRecords(
226  self::VALUE_PageId,
227  [
228  self::TABLE_Content => ['uid' => $this->recordIds['localizedContentId'], self::FIELD_ContentHotel => '0'],
229  self::TABLE_Hotel => ['uid' => $this->recordIds['localizedHotelId'], self::FIELD_ContentHotel => '0'],
230  self::TABLE_Offer => ['uid' => $this->recordIds['localizedOfferId'], self::FIELD_ContentHotel => '0'],
231  ]
232  );
233  }
234 
235  public function ‪changeParentContentSorting(): void
236  {
237  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
238  }
239 
240  public function ‪moveParentContentToDifferentPage(): void
241  {
242  $newRecordIds = $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
243  // In workspaces new records are created and discard drops this one again, live creates no new record
244  if (isset($newRecordIds[self::TABLE_Content][self::VALUE_ContentIdLast])) {
245  $this->recordIds['newContentId'] = $newRecordIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
246  }
247  }
248 
249  public function ‪moveParentContentToDifferentPageTwice(): void
250  {
251  $newRecordIds = $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
252  $this->recordIds['newContentId'] = $newRecordIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
253  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdWebsite);
254  }
255 
257  {
258  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
259  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
260  }
261 
269  public function ‪modifyPage(): void
270  {
271  $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1']);
272  }
273 
274  public function ‪deletePage(): void
275  {
276  $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
277  }
278 
279  public function ‪copyPage(): void
280  {
281  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
282  $this->recordIds['newPageId'] = $newTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
283  $this->recordIds['newContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdFirst];
284  $this->recordIds['newContentIdLast'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
285  }
286 
287  public function ‪copyPageWithHotelBeforeParentContent(): void
288  {
289  // Ensure hotels get processed first
290  ‪$GLOBALS['TCA'] = array_merge(
291  [self::TABLE_Hotel => ‪$GLOBALS['TCA'][self::TABLE_Hotel]],
292  ‪$GLOBALS['TCA']
293  );
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 
309  {
310  $newTableIds = $this->actionService->createNewRecords(
311  self::VALUE_PageId,
312  [
313  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
314  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
315  self::TABLE_Offer => ['title' => 'Offer #1'],
316  ]
317  );
318  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
319  }
320 
322  {
323  $newTableIds = $this->actionService->createNewRecords(
324  self::VALUE_PageId,
325  [
326  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
327  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
328  self::TABLE_Offer => ['title' => 'Offer #1'],
329  ]
330  );
331  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
332  $this->recordIds['newHotelId'] = $newTableIds[‪self::TABLE_Hotel][0];
333  $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
334  $this->recordIds['copiedContentId'] = $copiedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
335  $this->recordIds['copiedHotelId'] = $copiedTableIds[‪self::TABLE_Hotel][$this->recordIds['newHotelId']];
336  }
337 
339  {
340  $newTableIds = $this->actionService->createNewRecords(
341  self::VALUE_PageId,
342  [
343  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
344  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
345  self::TABLE_Offer => ['title' => 'Offer #1'],
346  ]
347  );
348  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
349  $this->recordIds['newHotelId'] = $newTableIds[‪self::TABLE_Hotel][0];
350  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
351  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
352  }
353 
355  {
356  unset(‪$GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['sortby']);
357  $newTableIds = $this->actionService->createNewRecords(
358  self::VALUE_PageId,
359  [
360  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
361  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
362  self::TABLE_Offer => ['title' => 'Offer #1'],
363  ]
364  );
365  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
366  $this->recordIds['newHotelId'] = $newTableIds[‪self::TABLE_Hotel][0];
367  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
368  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
369  }
370 
371  public function ‪modifyOnlyHotelChild(): void
372  {
373  $this->actionService->modifyRecord(self::TABLE_Hotel, 4, ['title' => 'Testing #1']);
374  }
375 
376  public function ‪modifyParentAndChangeHotelChildrenSorting(): void
377  {
378  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, [self::FIELD_ContentHotel => '4,3']);
379  }
380 
381  public function ‪modifyParentWithHotelChild(): void
382  {
383  $this->actionService->modifyRecords(
384  self::VALUE_PageId,
385  [
386  self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'],
387  self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
388  ]
389  );
390  }
391 
392  public function ‪modifyParentAndAddHotelChild(): void
393  {
394  $this->actionService->modifyRecords(
395  self::VALUE_PageId,
396  [
397  self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'],
398  self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #2'],
399  ]
400  );
401  }
402 
403  public function ‪modifyParentAndDeleteHotelChild(): void
404  {
405  $this->actionService->modifyRecord(
406  self::TABLE_Content,
407  self::VALUE_ContentIdFirst,
408  [self::FIELD_ContentHotel => '3'],
409  [self::TABLE_Hotel => [4]]
410  );
411  }
412 
413  public function ‪localizePageWithLocalizationExclude(): void
414  {
415  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
416  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
417  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
418  }
419 
420  public function ‪localizePageTwiceWithLocalizationExclude(): 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['localizedPageIdFirst'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
425  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageIdSecond);
426  $this->recordIds['localizedPageIdSecond'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
427  }
428 
430  {
431  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['l10n_mode'] = 'exclude';
432  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
433  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
434  $this->actionService->modifyRecords(
435  self::VALUE_PageId,
436  [
437  self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
438  self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
439  ]
440  );
441  }
442 
443  public function ‪localizePageWithLanguageSynchronization(): void
444  {
445  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
446  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
447  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
448  }
449 
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  $this->actionService->modifyRecords(
456  self::VALUE_PageId,
457  [
458  self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
459  self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
460  ]
461  );
462  }
463 
465  {
466  unset(‪$GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['languageField']);
467  unset(‪$GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['transOrigPointerField']);
468  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
469  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
470  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
471  $this->actionService->modifyRecords(
472  self::VALUE_PageId,
473  [
474  self::TABLE_Page => ['uid' => self::VALUE_PageId, self::FIELD_PageHotel => '2,__nextUid'],
475  self::TABLE_Hotel => ['uid' => '__NEW', 'title' => 'Hotel #007'],
476  ]
477  );
478  }
479 
481  {
482  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
483  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
484  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
485  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
486  $this->recordIds['newPageId'] = $newTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
487  }
488 
490  {
491  ‪$GLOBALS['TCA'][‪self::TABLE_Page]['columns'][‪self::FIELD_PageHotel]['config']['behaviour']['allowLanguageSynchronization'] = true;
492  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
493  $this->recordIds['localizedPageId'] = $localizedTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
494  // Using "localized page ID" on purpose because BE editing uses a "page" record and data handler
495  $this->actionService->modifyRecords(
496  $this->recordIds['localizedPageId'],
497  [
498  self::TABLE_Page => ['uid' => $this->recordIds['localizedPageId'], self::FIELD_PageHotel => '6,__nextUid', 'l10n_state' => [self::FIELD_PageHotel => 'custom']],
499  self::TABLE_Hotel => ['uid' => '__NEW', 'sys_language_uid' => self::VALUE_LanguageId, 'title' => 'Hotel in dansk page only'],
500  ]
501  );
502  }
503 
504  public function ‪inlineLocalizeSynchronizeLocalizeMissing(): void
505  {
506  // Translate page 89 first
507  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
508  // Localize CE 297 which has two hotels, those are localized, too.
509  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, self::VALUE_LanguageId);
510  $this->recordIds['localizedContentId'] = $newTableIds['tt_content'][‪self::VALUE_ContentIdFirst];
511  $this->recordIds['localizedHotelId'] = $newTableIds['tx_testirreforeignfieldnonws_hotel'][‪self::VALUE_HotelIdFirst];
512  // Delete one localized hotel (and its children) again.
513  // We end up with having one localized hotel child and a missing one, while both exist in default language.
514  $this->actionService->deleteRecord('tx_testirreforeignfieldnonws_hotel', $this->recordIds['localizedHotelId']);
515  // Now inlineLocalizeSynchronize->localize - This is the 'localize all records' button when inline
516  // 'appearance' 'showAllLocalizationLink' has been enabled. It should re-localize the missing hotel again.
517  $this->actionService->invoke(
518  [],
519  [
520  'tt_content' => [
521  $this->recordIds['localizedContentId'] => [
522  'inlineLocalizeSynchronize' => [
523  'field' => 'tx_testirreforeignfieldnonws_hotels',
524  'language' => 1,
525  'action' => 'localize',
526  ],
527  ],
528  ],
529  ]
530  );
531  }
532 }
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\copyPageWithHotelBeforeParentContent
‪copyPageWithHotelBeforeParentContent()
Definition: AbstractActionTestCase.php:286
‪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\IrreForeignFieldNonWs\AbstractActionTestCase\copyParentContentToDifferentPage
‪copyParentContentToDifferentPage()
Definition: AbstractActionTestCase.php:100
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizeParentContentAndSetInvalidChildReferenceWithLanguageSynchronization
‪localizeParentContentAndSetInvalidChildReferenceWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:195
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: AbstractActionTestCase.php:52
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\createAndCopyParentContentWithHotelAndOfferChildren
‪createAndCopyParentContentWithHotelAndOfferChildren()
Definition: AbstractActionTestCase.php:320
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizeParentContentChainLanguageSynchronizationSource
‪localizeParentContentChainLanguageSynchronizationSource()
Definition: AbstractActionTestCase.php:121
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_OfferIdLast
‪const VALUE_OfferIdLast
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs
Definition: AbstractActionTestCase.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizePageAndAddHotelChildWithLocalizationExclude
‪localizePageAndAddHotelChildWithLocalizationExclude()
Definition: AbstractActionTestCase.php:428
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\FIELD_ContentHotel
‪const FIELD_ContentHotel
Definition: AbstractActionTestCase.php:46
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_HotelIdSecond
‪const VALUE_HotelIdSecond
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait
Definition: SiteBasedTestTrait.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\modifyParentAndChangeHotelChildrenSorting
‪modifyParentAndChangeHotelChildrenSorting()
Definition: AbstractActionTestCase.php:375
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\SCENARIO_DataSet
‪const SCENARIO_DataSet
Definition: AbstractActionTestCase.php:50
‪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\IrreForeignFieldNonWs\AbstractActionTestCase\moveParentContentToDifferentPageAndChangeSorting
‪moveParentContentToDifferentPageAndChangeSorting()
Definition: AbstractActionTestCase.php:255
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizeAndCopyPageWithLanguageSynchronization
‪localizeAndCopyPageWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:479
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizeParentContentWithAllChildren
‪localizeParentContentWithAllChildren()
Definition: AbstractActionTestCase.php:151
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:88
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase
Definition: AbstractActionTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\moveParentContentToDifferentPageTwice
‪moveParentContentToDifferentPageTwice()
Definition: AbstractActionTestCase.php:248
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\copyPage
‪copyPage()
Definition: AbstractActionTestCase.php:278
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\inlineLocalizeSynchronizeLocalizeMissing
‪inlineLocalizeSynchronizeLocalizeMissing()
Definition: AbstractActionTestCase.php:503
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizeParentContentWithLanguageSynchronization
‪localizeParentContentWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:109
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\modifyParentAndDeleteHotelChild
‪modifyParentAndDeleteHotelChild()
Definition: AbstractActionTestCase.php:402
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\deletePage
‪deletePage()
Definition: AbstractActionTestCase.php:273
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\modifyOnlyHotelChild
‪modifyOnlyHotelChild()
Definition: AbstractActionTestCase.php:370
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizeParentContentAndSetInvalidChildReferenceWithLateLanguageSynchronization
‪localizeParentContentAndSetInvalidChildReferenceWithLateLanguageSynchronization()
Definition: AbstractActionTestCase.php:209
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizePageTwiceWithLocalizationExclude
‪localizePageTwiceWithLocalizationExclude()
Definition: AbstractActionTestCase.php:419
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_LanguageIdSecond
‪const VALUE_LanguageIdSecond
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\modifyParentWithHotelChild
‪modifyParentWithHotelChild()
Definition: AbstractActionTestCase.php:380
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\createParentContentWithHotelAndOfferChildren
‪createParentContentWithHotelAndOfferChildren()
Definition: AbstractActionTestCase.php:307
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\modifyParentAndAddHotelChild
‪modifyParentAndAddHotelChild()
Definition: AbstractActionTestCase.php:391
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\copyParentContentToLanguageWithAllChildren
‪copyParentContentToLanguageWithAllChildren()
Definition: AbstractActionTestCase.php:145
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\changeParentContentSorting
‪changeParentContentSorting()
Definition: AbstractActionTestCase.php:234
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizePageAndAddHotelChildWithLanguageSynchronization
‪localizePageAndAddHotelChildWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:449
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:40
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\moveParentContentToDifferentPage
‪moveParentContentToDifferentPage()
Definition: AbstractActionTestCase.php:239
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_HotelIdThird
‪const VALUE_HotelIdThird
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizePageWithSynchronizationAndCustomLocalizedHotel
‪localizePageWithSynchronizationAndCustomLocalizedHotel()
Definition: AbstractActionTestCase.php:488
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_HotelIdFirst
‪const VALUE_HotelIdFirst
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\createAndLocalizeParentContentWithHotelAndOfferChildren
‪createAndLocalizeParentContentWithHotelAndOfferChildren()
Definition: AbstractActionTestCase.php:337
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\TABLE_Price
‪const TABLE_Price
Definition: AbstractActionTestCase.php:43
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\createParentContent
‪createParentContent()
Definition: AbstractActionTestCase.php:78
‪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\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\TABLE_Hotel
‪const TABLE_Hotel
Definition: AbstractActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizePageWithLocalizationExclude
‪localizePageWithLocalizationExclude()
Definition: AbstractActionTestCase.php:412
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization
‪localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:160
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_PageIdWebsite
‪const VALUE_PageIdWebsite
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizePageWithLanguageSynchronization
‪localizePageWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:442
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\FIELD_HotelOffer
‪const FIELD_HotelOffer
Definition: AbstractActionTestCase.php:47
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration
‪createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration()
Definition: AbstractActionTestCase.php:353
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\modifyPage
‪modifyPage()
Definition: AbstractActionTestCase.php:268
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\FIELD_PageHotel
‪const FIELD_PageHotel
Definition: AbstractActionTestCase.php:45
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:56
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\TABLE_Page
‪const TABLE_Page
Definition: AbstractActionTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\TABLE_Offer
‪const TABLE_Offer
Definition: AbstractActionTestCase.php:42
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\localizePageAndAddMonoglotHotelChildWithLanguageSynchronization
‪localizePageAndAddMonoglotHotelChildWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:463
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static getUniqueId(string $prefix='')
Definition: StringUtility.php:57
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\copyParentContent
‪copyParentContent()
Definition: AbstractActionTestCase.php:94
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\modifyParentContent
‪modifyParentContent()
Definition: AbstractActionTestCase.php:84
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\FIELD_OfferPrice
‪const FIELD_OfferPrice
Definition: AbstractActionTestCase.php:48
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignFieldNonWs\AbstractActionTestCase\deleteParentContent
‪deleteParentContent()
Definition: AbstractActionTestCase.php:89