‪TYPO3CMS  ‪main
ActionTest.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 
20 use PHPUnit\Framework\Attributes\Test;
22 use TYPO3\TestingFramework\Core\Functional\Framework\Constraint\RequestSection\DoesNotHaveRecordConstraint;
23 use TYPO3\TestingFramework\Core\Functional\Framework\Constraint\RequestSection\HasRecordConstraint;
24 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
25 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext;
26 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\ResponseContent;
27 
29 {
30  #[Test]
31  public function ‪verifyCleanReferenceIndex(): void
32  {
33  // The test verifies the imported data set has a clean reference index by the check in tearDown()
34  self::assertTrue(true);
35  }
36 
37  #[Test]
38  public function ‪createContents(): void
39  {
40  parent::createContents();
41  $this->actionService->clearWorkspaceRecords(
42  [
43  self::TABLE_Content => [$this->recordIds['newContentIdFirst'], $this->recordIds['newContentIdLast']],
44  ]
45  );
46  $this->assertCSVDataSet(__DIR__ . '/DataSet/createContents.csv');
47  }
48 
49  #[Test]
50  public function ‪createContentAndCopyContent(): void
51  {
52  parent::createContentAndCopyContent();
53  // discard copied content
54  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['versionedCopiedContentId']);
55  $this->assertCSVDataSet(__DIR__ . '/DataSet/createContentAndCopyContent.csv');
56  }
57 
58  #[Test]
59  public function ‪createContentAndLocalize(): void
60  {
61  parent::createContentAndLocalize();
62  // discard default language content
63  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['newContentId']);
64  $this->assertCSVDataSet(__DIR__ . '/DataSet/createContentAndLocalize.csv');
65  }
66 
67  #[Test]
68  public function ‪modifyContent(): void
69  {
70  parent::modifyContent();
71  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
72  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyContent.csv');
73  }
74 
75  #[Test]
76  public function ‪hideContent(): void
77  {
78  parent::hideContent();
79  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
80  $this->assertCSVDataSet(__DIR__ . '/DataSet/hideContent.csv');
81  }
82 
83  #[Test]
84  public function ‪hideContentAndMoveToDifferentPage(): void
85  {
86  parent::hideContent();
87  parent::moveContentToDifferentPage();
88  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
89  $this->assertCSVDataSet(__DIR__ . '/DataSet/hideContentAndMoveToDifferentPage.csv');
90  }
91 
92  #[Test]
93  public function ‪deleteContent(): void
94  {
95  parent::deleteContent();
96  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
97  $this->assertCSVDataSet(__DIR__ . '/DataSet/deleteContent.csv');
98  }
99 
100  #[Test]
102  {
103  // Create translated page first
104  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
105  parent::deleteLocalizedContentAndDeleteContent();
106  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdThird);
107  $this->assertCSVDataSet(__DIR__ . '/DataSet/deleteLocalizedContentNDeleteContent.csv');
108  }
109 
110  #[Test]
111  public function ‪copyContent(): void
112  {
113  parent::copyContent();
114  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['copiedContentId']);
115  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyContent.csv');
116  }
117 
118  #[Test]
119  public function ‪copyContentToLanguage(): void
120  {
121  // Create translated page first
122  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
123  parent::copyContentToLanguage();
124  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
125  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyContentToLanguage.csv');
126  }
127 
128  #[Test]
130  {
131  // Create translated page first
132  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
133  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageIdSecond);
134  parent::copyContentToLanguageFromNonDefaultLanguage();
135  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
136  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyContentToLanguageFromNonDefaultLanguage.csv');
137  }
138 
139  #[Test]
140  public function ‪localizeContent(): void
141  {
142  // Create translated page first
143  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
144  parent::localizeContent();
145  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
146  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeContent.csv');
147  }
148 
149  #[Test]
150  public function ‪localizeContentAfterMovedContent(): void
151  {
152  parent::localizeContentAfterMovedContent();
153  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
154  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeContentAfterMovedContent.csv');
155  }
156 
157  #[Test]
159  {
160  parent::localizeContentAfterMovedInLiveContent();
161  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
162  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeContentAfterMovedInLiveContent.csv');
163  }
164 
165  #[Test]
167  {
168  // Create translated page first
169  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
170  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageIdSecond);
171  parent::localizeContentFromNonDefaultLanguage();
172  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
173  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeContentFromNonDefaultLanguage.csv');
174  }
175 
176  #[Test]
177  public function ‪changeContentSorting(): void
178  {
179  parent::changeContentSorting();
180  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
181  $this->assertCSVDataSet(__DIR__ . '/DataSet/changeContentSorting.csv');
182  }
183 
184  #[Test]
185  public function ‪changeContentSortingAfterSelf(): void
186  {
187  parent::changeContentSortingAfterSelf();
188  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
189  $this->assertCSVDataSet(__DIR__ . '/DataSet/changeContentSortingAfterSelf.csv');
190  }
191 
192  #[Test]
194  {
195  parent::changeContentSortingAndDeleteMovedRecord();
196  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
197  // Note the deleted=1 records are NOT discarded. This is ok since deleted=1 means "not seen in backend",
198  // so it is also ignored by the discard operation.
199  $this->assertCSVDataSet(__DIR__ . '/DataSet/changeContentSortingNDeleteMovedRecord.csv');
200  }
201 
202  #[Test]
204  {
205  parent::changeContentSortingAndDeleteLiveRecord();
206  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
207  // Note the deleted=1 records are NOT discarded. This is ok since deleted=1 means "not seen in backend",
208  // so it is also ignored by the discard operation.
209  $this->assertCSVDataSet(__DIR__ . '/DataSet/changeContentSortingNDeleteLiveRecord.csv');
210  }
211 
212  #[Test]
213  public function ‪moveContentToDifferentPage(): void
214  {
215  parent::moveContentToDifferentPage();
216  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
217  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveContentToDifferentPage.csv');
218  }
219 
220  #[Test]
222  {
223  parent::moveContentToDifferentPageAndChangeSorting();
224  $this->actionService->clearWorkspaceRecords([
225  self::TABLE_Content => [self::VALUE_ContentIdFirst, self::VALUE_ContentIdSecond],
226  ]);
227  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveContentToDifferentPageNChangeSorting.csv');
228  }
229 
230  #[Test]
231  public function ‪moveContentToDifferentPageAndHide(): void
232  {
233  parent::moveContentToDifferentPageAndHide();
234  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
235  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveContentToDifferentPageAndHide.csv');
236  }
237 
238  #[Test]
240  {
241  parent::moveLocalizedContentToDifferentPage();
242  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, self::VALUE_ContentIdThird);
243  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveLocalizedContentToDifferentPage.csv');
244 
245  // Check if the regular page contains the original record again
246  $response = $this->executeFrontendSubRequest(
247  (new InternalRequest())->withPageId(self::VALUE_PageId),
248  (new InternalRequestContext())->withBackendUserId(self::VALUE_BackendUserId)->withWorkspaceId(self::VALUE_WorkspaceId)
249  );
250  $responseSectionsSource = ResponseContent::fromString((string)$response->getBody())->getSections();
251  self::assertThat($responseSectionsSource, (new HasRecordConstraint())
252  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #3'));
253 
265  // Check if the target page does not contain the moved record
266  $response = $this->executeFrontendSubRequest(
267  (new InternalRequest())->withPageId(self::VALUE_PageIdTarget),
268  (new InternalRequestContext())->withBackendUserId(self::VALUE_BackendUserId)->withWorkspaceId(self::VALUE_WorkspaceId)
269  );
270  $responseSectionsTarget = ResponseContent::fromString((string)$response->getBody())->getSections();
271  self::assertThat($responseSectionsTarget, (new DoesNotHaveRecordConstraint())
272  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #3'));
273 
274  // Also test the translated page, and make sure the translated record is also discarded
275  $response = $this->executeFrontendSubRequest(
276  (new InternalRequest())->withPageId(self::VALUE_PageIdTarget)->withLanguageId(self::VALUE_LanguageId),
277  (new InternalRequestContext())->withBackendUserId(self::VALUE_BackendUserId)->withWorkspaceId(self::VALUE_WorkspaceId)
278  );
279  $responseSectionsTarget = ResponseContent::fromString((string)$response->getBody())->getSections();
280  self::assertThat($responseSectionsTarget, (new DoesNotHaveRecordConstraint())
281  ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Regular Element #3'));
282  }
283 
284  #[Test]
285  public function ‪createPage(): void
286  {
287  parent::createPage();
288  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['newPageId']);
289  $this->assertCSVDataSet(__DIR__ . '/DataSet/createPage.csv');
290  }
291 
292  #[Test]
294  {
295  parent::createPageAndSubPageAndSubPageContent();
296  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['newPageId']);
297  $this->assertCSVDataSet(__DIR__ . '/DataSet/createPageAndSubPageAndSubPageContent.csv');
298  }
299 
300  #[Test]
301  public function ‪modifyPage(): void
302  {
303  parent::modifyPage();
304  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
305  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyPage.csv');
306  }
307 
308  #[Test]
309  public function ‪deletePage(): void
310  {
311  parent::deletePage();
312  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
313  $this->assertCSVDataSet(__DIR__ . '/DataSet/deletePage.csv');
314  }
315 
316  #[Test]
317  public function ‪deleteContentAndPage(): void
318  {
319  parent::deleteContentAndPage();
320  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
321  $this->assertCSVDataSet(__DIR__ . '/DataSet/deleteContentAndPage.csv');
322  }
323 
324  #[Test]
326  {
327  // Create localized page and localize content elements first
328  parent::localizePageAndContentsAndDeletePageLocalization();
329  // Deleted records are not discarded
330  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
331  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageAndContentsAndDeletePageLocalization.csv');
332  }
333 
334  #[Test]
335  public function ‪localizeNestedPagesAndContents(): void
336  {
337  parent::localizeNestedPagesAndContents();
338  // Should discard the localized parent page and its content elements, but no sub page change or default lang content element
339  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedParentPageId']);
340  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeNestedPagesAndContents.csv');
341  }
342 
343  #[Test]
344  public function ‪copyPage(): void
345  {
346  parent::copyPage();
347  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['newPageId']);
348  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyPage.csv');
349  }
350 
351  #[Test]
352  public function ‪copyPageFreeMode(): void
353  {
354  parent::copyPageFreeMode();
355  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['newPageId']);
356  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyPageFreeMode.csv');
357  }
358 
359  #[Test]
360  public function ‪localizePage(): void
361  {
362  parent::localizePage();
363  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
364  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePage.csv');
365  }
366 
367  #[Test]
368  public function ‪localizePageHiddenHideAtCopyFalse(): void
369  {
370  parent::localizePageHiddenHideAtCopyFalse();
371  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
372  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageHiddenHideAtCopyFalse.csv');
373  }
374 
375  #[Test]
377  {
378  parent::localizePageNotHiddenHideAtCopyFalse();
379  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
380  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageNotHiddenHideAtCopyFalse.csv');
381  }
382 
383  #[Test]
385  {
386  parent::localizePageNotHiddenHideAtCopyDisableHideAtCopyUnset();
387  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
388  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageNotHiddenHideAtCopyDisableHideAtCopyUnset.csv');
389  }
390 
391  #[Test]
393  {
394  parent::localizePageHiddenHideAtCopyDisableHideAtCopyUnset();
395  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
396  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageHiddenHideAtCopyDisableHideAtCopyUnset.csv');
397  }
398 
399  #[Test]
401  {
402  parent::localizePageNotHiddenHideAtCopyDisableHideAtCopySetToFalse();
403  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
404  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageNotHiddenHideAtCopyDisableHideAtCopySetToFalse.csv');
405  }
406 
407  #[Test]
409  {
410  parent::localizePageHiddenHideAtCopyDisableHideAtCopySetToFalse();
411  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
412  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageHiddenHideAtCopyDisableHideAtCopySetToFalse.csv');
413  }
414 
415  #[Test]
417  {
418  parent::localizePageNotHiddenHideAtCopyDisableHideAtCopySetToTrue();
419  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
420  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageNotHiddenHideAtCopyDisableHideAtCopySetToTrue.csv');
421  }
422 
423  #[Test]
425  {
426  parent::localizePageHiddenHideAtCopyDisableHideAtCopySetToTrue();
427  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['localizedPageId']);
428  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageHiddenHideAtCopyDisableHideAtCopySetToTrue.csv');
429  }
430 
431  #[Test]
432  public function ‪createPageAndChangePageSorting(): void
433  {
434  parent::createPageAndChangePageSorting();
435  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['newPageId']);
436  $this->assertCSVDataSet(__DIR__ . '/DataSet/createPageAndChangePageSorting.csv');
437  }
438 
439  #[Test]
440  public function ‪createPageAndMoveCreatedPage(): void
441  {
442  parent::createPageAndMoveCreatedPage();
443  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['newPageId']);
444  $this->assertCSVDataSet(__DIR__ . '/DataSet/createPageAndMoveCreatedPage.csv');
445  }
446 
447  #[Test]
448  public function ‪changePageSorting(): void
449  {
450  parent::changePageSorting();
451  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
452  $this->assertCSVDataSet(__DIR__ . '/DataSet/changePageSorting.csv');
453  }
454 
455  #[Test]
456  public function ‪changePageSortingAfterSelf(): void
457  {
458  parent::changePageSortingAfterSelf();
459  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
460  $this->assertCSVDataSet(__DIR__ . '/DataSet/changePageSortingAfterSelf.csv');
461  }
462 
463  #[Test]
464  public function ‪movePageToDifferentPage(): void
465  {
466  parent::movePageToDifferentPage();
467  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
468  $this->assertCSVDataSet(__DIR__ . '/DataSet/movePageToDifferentPage.csv');
469  }
470 
471  #[Test]
472  public function ‪movePageToDifferentPageTwice(): void
473  {
474  parent::movePageToDifferentPageTwice();
475  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
476  $this->assertCSVDataSet(__DIR__ . '/DataSet/movePageToDifferentPageTwice.csv');
477  }
478 
479  #[Test]
481  {
482  parent::movePageLocalizedToDifferentPageTwice();
483  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
484  $this->assertCSVDataSet(__DIR__ . '/DataSet/movePageLocalizedToDifferentPageTwice.csv');
485  }
486 
487  #[Test]
489  {
490  parent::movePageLocalizedInLiveToDifferentPageTwice();
491  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
492  $this->assertCSVDataSet(__DIR__ . '/DataSet/movePageLocalizedInLiveToDifferentPageTwice.csv');
493  }
494 
495  #[Test]
497  {
498  parent::movePageLocalizedInLiveWorkspaceChangedToDifferentPageTwice();
499  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
500  $this->assertCSVDataSet(__DIR__ . '/DataSet/movePageLocalizedInLiveWorkspaceChangedToDifferentPageTwice.csv');
501  }
502 
503  #[Test]
505  {
506  parent::movePageLocalizedInLiveWorkspaceDeletedToDifferentPageTwice();
507  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, self::VALUE_PageId);
508  $this->assertCSVDataSet(__DIR__ . '/DataSet/movePageLocalizedInLiveWorkspaceDeletedToDifferentPageTwice.csv');
509  }
510 
511  #[Test]
513  {
514  parent::movePageToDifferentPageAndChangeSorting();
515  $this->actionService->clearWorkspaceRecords([
516  self::TABLE_Page => [self::VALUE_PageId, self::VALUE_PageIdTarget],
517  ]);
518  $this->assertCSVDataSet(__DIR__ . '/DataSet/movePageToDifferentPageNChangeSorting.csv');
519  }
520 
525  #[Test]
527  {
528  parent::movePageToDifferentPageAndCreatePageAfterMovedPage();
529  $this->actionService->clearWorkspaceRecords([
530  self::TABLE_Page => [self::VALUE_PageIdTarget, $this->recordIds['newPageId']],
531  ]);
532  $this->assertCSVDataSet(__DIR__ . '/DataSet/movePageToDifferentPageNCreatePageAfterMovedPage.csv');
533  }
534 
535  /*************************************
536  * Copying page contents and sub-pages
537  *************************************/
538  #[Test]
539  public function ‪createContentAndCopyDraftPage(): void
540  {
541  parent::createContentAndCopyDraftPage();
542  $this->actionService->clearWorkspaceRecords([
543  self::TABLE_Content => [$this->recordIds['newContentId']],
544  self::TABLE_Page => [$this->recordIds['copiedPageId']],
545  ]);
546  $this->assertCSVDataSet(__DIR__ . '/DataSet/createContentAndCopyDraftPage.csv');
547  }
548 
549  #[Test]
550  public function ‪createPageAndCopyDraftParentPage(): void
551  {
552  parent::createPageAndCopyDraftParentPage();
553  $this->actionService->clearWorkspaceRecords([
554  self::TABLE_Page => [$this->recordIds['newPageId'], $this->recordIds['copiedPageId']],
555  ]);
556  $this->assertCSVDataSet(__DIR__ . '/DataSet/createPageAndCopyDraftParentPage.csv');
557  }
558 
559  #[Test]
561  {
562  parent::createNestedPagesAndCopyDraftParentPage();
563  // Discarding only the copied parent page to see what happens with sub pages
564  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['copiedPageId']);
565  $this->assertCSVDataSet(__DIR__ . '/DataSet/createNestedPagesAndCopyDraftParentPage.csv');
566  }
567 
568  #[Test]
570  {
571  parent::createPlaceholdersAndDeleteDraftParentPage();
572  $this->actionService->clearWorkspaceRecord(self::TABLE_Page, $this->recordIds['deletedPageId']);
573  $this->assertCSVDataSet(__DIR__ . '/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv');
574  }
575 
579  #[Test]
581  {
582  // Switch to live workspace and localize page in live
583  $this->‪setWorkspaceId(0);
584  $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
585  $this->‪setWorkspaceId(self::VALUE_WorkspaceId);
586 
587  // Localize 'Regular Element #2' (289) in workspace "connected mode"
588  $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
589 
590  // And now *delete* the default language content element 'Regular Element #2' (289) in *live*,
591  // which should *discard* the above localized content element in workspaces again.
592  $this->‪setWorkspaceId(0);
593  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
594  $this->‪setWorkspaceId(self::VALUE_WorkspaceId);
595 
596  $this->assertCSVDataSet(__DIR__ . '/DataSet/deletingDefaultLanguageElementDiscardsConnectedLocalizedElement.csv');
597  }
598 
605  #[Test]
607  {
608  // Switch to live workspace and localize page in live
609  $this->‪setWorkspaceId(0);
610  $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
611  $this->‪setWorkspaceId(self::VALUE_WorkspaceId);
612 
613  // Localize 'Regular Element #2' (289) in workspace "connected mode"
614  $newRecordIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
615  $localizedRecordId = $newRecordIds['tt_content'][‪self::VALUE_ContentIdSecond];
616  // Localize 'Regular Element #2' (289) in workspace "connected mode" to language 2 as 'translation of translation':
617  // l10n_parent still points to 289, but l10n_source points to 321.
618  $this->actionService->localizeRecord(self::TABLE_Content, $localizedRecordId, self::VALUE_LanguageIdSecond);
619 
620  // And now *delete* the default language content element 'Regular Element #2' (289) in *live*,
621  // which should *discard* the above localized content elements in workspaces again.
622  $this->‪setWorkspaceId(0);
623  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
624  $this->‪setWorkspaceId(self::VALUE_WorkspaceId);
625 
626  $this->assertCSVDataSet(__DIR__ . '/DataSet/deletingDefaultLanguageElementDiscardsConnectedLocalizedElementChain.csv');
627  }
628 }
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\hideContent
‪hideContent()
Definition: ActionTest.php:76
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\deletingDefaultLanguageElementDiscardsConnectedLocalizedElementChain
‪deletingDefaultLanguageElementDiscardsConnectedLocalizedElementChain()
Definition: ActionTest.php:606
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\AbstractActionTestCase\VALUE_ContentIdSecond
‪const VALUE_ContentIdSecond
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createContentAndCopyDraftPage
‪createContentAndCopyDraftPage()
Definition: ActionTest.php:539
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageNotHiddenHideAtCopyFalse
‪localizePageNotHiddenHideAtCopyFalse()
Definition: ActionTest.php:376
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\changeContentSorting
‪changeContentSorting()
Definition: ActionTest.php:177
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest
Definition: ActionTest.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\copyPage
‪copyPage()
Definition: ActionTest.php:344
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\movePageToDifferentPageAndChangeSorting
‪movePageToDifferentPageAndChangeSorting()
Definition: ActionTest.php:512
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createPageAndSubPageAndSubPageContent
‪createPageAndSubPageAndSubPageContent()
Definition: ActionTest.php:293
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageNotHiddenHideAtCopyDisableHideAtCopyUnset
‪localizePageNotHiddenHideAtCopyDisableHideAtCopyUnset()
Definition: ActionTest.php:384
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizeContentFromNonDefaultLanguage
‪localizeContentFromNonDefaultLanguage()
Definition: ActionTest.php:166
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\movePageToDifferentPage
‪movePageToDifferentPage()
Definition: ActionTest.php:464
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizeContentAfterMovedInLiveContent
‪localizeContentAfterMovedInLiveContent()
Definition: ActionTest.php:158
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\deletePage
‪deletePage()
Definition: ActionTest.php:309
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\modifyContent
‪modifyContent()
Definition: ActionTest.php:68
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\copyContent
‪copyContent()
Definition: ActionTest.php:111
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageNotHiddenHideAtCopyDisableHideAtCopySetToFalse
‪localizePageNotHiddenHideAtCopyDisableHideAtCopySetToFalse()
Definition: ActionTest.php:400
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageNotHiddenHideAtCopyDisableHideAtCopySetToTrue
‪localizePageNotHiddenHideAtCopyDisableHideAtCopySetToTrue()
Definition: ActionTest.php:416
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\AbstractDataHandlerActionTestCase\setWorkspaceId
‪setWorkspaceId(int $workspaceId)
Definition: AbstractDataHandlerActionTestCase.php:76
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\modifyPage
‪modifyPage()
Definition: ActionTest.php:301
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\moveContentToDifferentPageAndChangeSorting
‪moveContentToDifferentPageAndChangeSorting()
Definition: ActionTest.php:221
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizeContentAfterMovedContent
‪localizeContentAfterMovedContent()
Definition: ActionTest.php:150
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\moveLocalizedContentToDifferentPage
‪moveLocalizedContentToDifferentPage()
Definition: ActionTest.php:239
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageHiddenHideAtCopyDisableHideAtCopySetToTrue
‪localizePageHiddenHideAtCopyDisableHideAtCopySetToTrue()
Definition: ActionTest.php:424
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\movePageLocalizedInLiveWorkspaceChangedToDifferentPageTwice
‪movePageLocalizedInLiveWorkspaceChangedToDifferentPageTwice()
Definition: ActionTest.php:496
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\movePageLocalizedToDifferentPageTwice
‪movePageLocalizedToDifferentPageTwice()
Definition: ActionTest.php:480
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageHiddenHideAtCopyFalse
‪localizePageHiddenHideAtCopyFalse()
Definition: ActionTest.php:368
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createNestedPagesAndCopyDraftParentPage
‪createNestedPagesAndCopyDraftParentPage()
Definition: ActionTest.php:560
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\moveContentToDifferentPage
‪moveContentToDifferentPage()
Definition: ActionTest.php:213
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\verifyCleanReferenceIndex
‪verifyCleanReferenceIndex()
Definition: ActionTest.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\hideContentAndMoveToDifferentPage
‪hideContentAndMoveToDifferentPage()
Definition: ActionTest.php:84
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createPageAndMoveCreatedPage
‪createPageAndMoveCreatedPage()
Definition: ActionTest.php:440
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\deleteContent
‪deleteContent()
Definition: ActionTest.php:93
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\movePageLocalizedInLiveWorkspaceDeletedToDifferentPageTwice
‪movePageLocalizedInLiveWorkspaceDeletedToDifferentPageTwice()
Definition: ActionTest.php:504
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\moveContentToDifferentPageAndHide
‪moveContentToDifferentPageAndHide()
Definition: ActionTest.php:231
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard
Definition: ActionTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\deleteLocalizedContentAndDeleteContent
‪deleteLocalizedContentAndDeleteContent()
Definition: ActionTest.php:101
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createContents
‪createContents()
Definition: ActionTest.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createPageAndChangePageSorting
‪createPageAndChangePageSorting()
Definition: ActionTest.php:432
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\deleteContentAndPage
‪deleteContentAndPage()
Definition: ActionTest.php:317
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createContentAndCopyContent
‪createContentAndCopyContent()
Definition: ActionTest.php:50
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\AbstractActionWorkspacesTestCase
Definition: AbstractActionWorkspacesTestCase.php:21
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\movePageLocalizedInLiveToDifferentPageTwice
‪movePageLocalizedInLiveToDifferentPageTwice()
Definition: ActionTest.php:488
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\copyContentToLanguage
‪copyContentToLanguage()
Definition: ActionTest.php:119
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizeNestedPagesAndContents
‪localizeNestedPagesAndContents()
Definition: ActionTest.php:335
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageHiddenHideAtCopyDisableHideAtCopyUnset
‪localizePageHiddenHideAtCopyDisableHideAtCopyUnset()
Definition: ActionTest.php:392
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createPlaceholdersAndDeleteDraftParentPage
‪createPlaceholdersAndDeleteDraftParentPage()
Definition: ActionTest.php:569
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createPage
‪createPage()
Definition: ActionTest.php:285
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\copyContentToLanguageFromNonDefaultLanguage
‪copyContentToLanguageFromNonDefaultLanguage()
Definition: ActionTest.php:129
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageAndContentsAndDeletePageLocalization
‪localizePageAndContentsAndDeletePageLocalization()
Definition: ActionTest.php:325
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\deletingDefaultLanguageElementDiscardsConnectedLocalizedElement
‪deletingDefaultLanguageElementDiscardsConnectedLocalizedElement()
Definition: ActionTest.php:580
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\changePageSorting
‪changePageSorting()
Definition: ActionTest.php:448
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createContentAndLocalize
‪createContentAndLocalize()
Definition: ActionTest.php:59
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\createPageAndCopyDraftParentPage
‪createPageAndCopyDraftParentPage()
Definition: ActionTest.php:550
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePage
‪localizePage()
Definition: ActionTest.php:360
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizePageHiddenHideAtCopyDisableHideAtCopySetToFalse
‪localizePageHiddenHideAtCopyDisableHideAtCopySetToFalse()
Definition: ActionTest.php:408
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\changeContentSortingAndDeleteLiveRecord
‪changeContentSortingAndDeleteLiveRecord()
Definition: ActionTest.php:203
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\movePageToDifferentPageTwice
‪movePageToDifferentPageTwice()
Definition: ActionTest.php:472
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\changePageSortingAfterSelf
‪changePageSortingAfterSelf()
Definition: ActionTest.php:456
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\changeContentSortingAndDeleteMovedRecord
‪changeContentSortingAndDeleteMovedRecord()
Definition: ActionTest.php:193
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\changeContentSortingAfterSelf
‪changeContentSortingAfterSelf()
Definition: ActionTest.php:185
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\copyPageFreeMode
‪copyPageFreeMode()
Definition: ActionTest.php:352
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\localizeContent
‪localizeContent()
Definition: ActionTest.php:140
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\Regular\WorkspacesDiscard\ActionTest\movePageToDifferentPageAndCreatePageAfterMovedPage
‪movePageToDifferentPageAndCreatePageAfterMovedPage()
Definition: ActionTest.php:526