7a7e45ab5cdf70ea9d606754d850a63f3f64a0c9
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / Regular / AbstractActionTestCase.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Regular;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Functional test for the DataHandler
19 */
20 abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
21 {
22 const VALUE_ParentPageId = 88;
23 const VALUE_PageId = 89;
24 const VALUE_PageIdTarget = 90;
25 const VALUE_PageIdWebsite = 1;
26 const VALUE_ContentIdZero = 296;
27 const VALUE_ContentIdFirst = 297;
28 const VALUE_ContentIdSecond = 298;
29 const VALUE_ContentIdThird = 299;
30 const VALUE_ContentIdThirdLocalized = 300;
31
32 const VALUE_ContentIdTenth = 310;
33 const VALUE_ContentIdTenthLocalized = 311;
34 const VALUE_ContentIdTenthLocalized2 = 312;
35
36 const VALUE_LanguageId = 1;
37 const VALUE_LanguageIdSecond = 2;
38 const VALUE_WorkspaceId = 1;
39
40 const TABLE_Page = 'pages';
41 const TABLE_PageOverlay = 'pages_language_overlay';
42 const TABLE_Content = 'tt_content';
43
44 /**
45 * @var array
46 */
47 protected $coreExtensionsToLoad = [
48 'fluid',
49 'version',
50 'workspaces',
51 ];
52
53 /**
54 * @var string
55 */
56 protected $scenarioDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/DataSet/';
57
58 protected function setUp()
59 {
60 parent::setUp();
61 $this->importScenarioDataSet('LiveDefaultPages');
62 $this->importScenarioDataSet('LiveDefaultElements');
63 $this->importScenarioDataSet('ReferenceIndex');
64
65 $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts']);
66 $this->backendUser->workspace = self::VALUE_WorkspaceId;
67 }
68
69 /**
70 * Content records
71 */
72
73 /**
74 * @see DataSet/createContentRecords.csv
75 */
76 public function createContents()
77 {
78 // Creating record at the beginning of the page
79 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
80 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][0];
81 // Creating record at the end of the page (after last one)
82 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, -self::VALUE_ContentIdSecond, ['header' => 'Testing #2']);
83 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][0];
84 }
85
86 /**
87 * @see DataSet/createContentRecordAndDiscardCreatedContentRecord.csv
88 */
89 public function createContentAndDiscardCreatedContent()
90 {
91 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
92 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
93 $versionedNewContentId = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, $this->recordIds['newContentId']);
94 $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $versionedNewContentId);
95 }
96
97 /**
98 * @see DataSet/createAndCopyContentRecordAndDiscardCopiedContentRecord.csv
99 */
100 public function createAndCopyContentAndDiscardCopiedContent()
101 {
102 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
103 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
104 $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
105 $this->recordIds['copiedContentId'] = $copiedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
106 $versionedCopiedContentId = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, $this->recordIds['copiedContentId']);
107 $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $versionedCopiedContentId);
108 }
109
110 /**
111 * @see DataSet/modifyContentRecord.csv
112 */
113 public function modifyContent()
114 {
115 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, ['header' => 'Testing #1']);
116 }
117
118 /**
119 * @see DataSet/deleteContentRecord.csv
120 */
121 public function deleteContent()
122 {
123 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
124 }
125
126 /**
127 * @see DataSet/deleteLocalizedContentNDeleteContent.csv
128 */
129 public function deleteLocalizedContentAndDeleteContent()
130 {
131 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdThirdLocalized);
132 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdThird);
133 }
134
135 /**
136 * @see DataSet/copyContentRecord.csv
137 */
138 public function copyContent()
139 {
140 $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageId);
141 $this->recordIds['copiedContentId'] = $copiedTableIds[self::TABLE_Content][self::VALUE_ContentIdSecond];
142 }
143
144 /**
145 * @see DataSet/copyContentToLanguage.csv
146 */
147 public function copyContentToLanguage()
148 {
149 $copiedTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
150 $this->recordIds['localizedContentId'] = $copiedTableIds[self::TABLE_Content][self::VALUE_ContentIdSecond];
151 }
152
153 /**
154 * Free mode "translation" of a record in non default language
155 *
156 * @test
157 * @see DataSet/copyContentToLanguageFromNonDefaultLanguage.csv
158 */
159 public function copyContentToLanguageFromNonDefaultLanguage()
160 {
161 $copiedTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdThirdLocalized, self::VALUE_LanguageIdSecond);
162 $this->recordIds['localizedContentId'] = $copiedTableIds[self::TABLE_Content][self::VALUE_ContentIdThirdLocalized];
163 }
164
165 /**
166 * @see DataSet/localizeContentRecord.csv
167 */
168 public function localizeContent()
169 {
170 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
171 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][self::VALUE_ContentIdSecond];
172 }
173
174 /**
175 * @see DataSet/localizeContentRecord.csv
176 */
177 public function localizeContentFromNonDefaultLanguage()
178 {
179 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdThirdLocalized, self::VALUE_LanguageIdSecond);
180 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][self::VALUE_ContentIdThirdLocalized];
181 }
182
183 /**
184 * @see DataSet/changeContentRecordSorting.csv
185 */
186 public function changeContentSorting()
187 {
188 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
189 }
190
191 /**
192 * @see DataSet/changeContentSortingNDeleteMovedRecord.csv
193 */
194 public function changeContentSortingAndDeleteMovedRecord()
195 {
196 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
197 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
198 }
199
200 /**
201 * @see DataSet/changeContentSortingNDeleteLiveRecord.csv
202 */
203 public function changeContentSortingAndDeleteLiveRecord()
204 {
205 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
206 // Switch to live workspace
207 $this->backendUser->workspace = 0;
208 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
209 // Switch back to draft workspace
210 $this->backendUser->workspace = static::VALUE_WorkspaceId;
211 }
212
213 /**
214 * @see DataSet/moveContentRecordToDifferentPage.csv
215 */
216 public function moveContentToDifferentPage()
217 {
218 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget);
219 }
220
221 /**
222 * @see DataSet/moveContentRecordToDifferentPageAndChangeSorting.csv
223 */
224 public function moveContentToDifferentPageAndChangeSorting()
225 {
226 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget);
227 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
228 }
229
230 /**
231 * Page records
232 */
233
234 /**
235 * @see DataSet/createPageRecord.csv
236 */
237 public function createPage()
238 {
239 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1', 'hidden' => 0]);
240 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][0];
241 }
242
243 /**
244 * @see DataSet/modifyPageRecord.csv
245 */
246 public function modifyPage()
247 {
248 $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1']);
249 }
250
251 /**
252 * @see DataSet/deletePageRecord.csv
253 */
254 public function deletePage()
255 {
256 $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
257 }
258
259 /**
260 * @see DataSet/deleteContentAndPage.csv
261 */
262 public function deleteContentAndPage()
263 {
264 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
265 $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
266 }
267
268 /**
269 * @see DataSet/copyPageRecord.csv
270 */
271 public function copyPage()
272 {
273 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
274 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
275 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
276 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdSecond];
277 }
278
279 /**
280 * @test
281 * @see DataSet/copyPageFreeMode.csv
282 */
283 public function copyPageFreeMode()
284 {
285 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageIdTarget, self::VALUE_PageIdTarget);
286 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageIdTarget];
287 $this->recordIds['newContentIdTenth'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdTenth];
288 $this->recordIds['newContentIdTenthLocalized'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdTenthLocalized];
289 $this->recordIds['newContentIdTenthLocalized2'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdTenthLocalized2];
290 }
291
292 /**
293 * @see DataSet/localizePageRecord.csv
294 */
295 public function localizePage()
296 {
297 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
298 $this->recordIds['localizedPageOverlayId'] = $localizedTableIds[self::TABLE_PageOverlay][self::VALUE_PageId];
299 }
300
301 /**
302 * @see DataSet/changePageRecordSorting.csv
303 */
304 public function changePageSorting()
305 {
306 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
307 }
308
309 /**
310 * @see DataSet/movePageRecordToDifferentPage.csv
311 */
312 public function movePageToDifferentPage()
313 {
314 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
315 }
316
317 /**
318 * @see DataSet/movePageRecordToDifferentPageAndChangeSorting.csv
319 */
320 public function movePageToDifferentPageAndChangeSorting()
321 {
322 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageIdTarget, self::VALUE_PageIdWebsite);
323 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
324 }
325
326 /**
327 * @see DataSet/movePageRecordToDifferentPageAndCreatePageRecordAfterMovedPageRecord.csv
328 * @see http://forge.typo3.org/issues/33104
329 * @see http://forge.typo3.org/issues/55573
330 */
331 public function movePageToDifferentPageAndCreatePageAfterMovedPage()
332 {
333 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageIdTarget, self::VALUE_PageIdWebsite);
334 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Page, -self::VALUE_PageIdTarget, ['title' => 'Testing #1', 'hidden' => 0]);
335 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][0];
336 }
337
338 /**
339 * Creates a content element and copies the page in draft workspace.
340 */
341 public function createContentAndCopyDraftPage()
342 {
343 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
344 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
345 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
346 $this->recordIds['copiedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
347 }
348
349 /**
350 * Creates a content element and copies the page in live workspace.
351 */
352 public function createContentAndCopyLivePage()
353 {
354 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
355 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
356
357 // Switch to live workspace
358 $this->backendUser->workspace = 0;
359
360 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
361 $this->recordIds['copiedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
362
363 // Switch back to draft workspace
364 $this->backendUser->workspace = static::VALUE_WorkspaceId;
365 }
366
367 /**
368 * Creates a page in a draft workspace and copies the parent page in draft workspace.
369 */
370 public function createPageAndCopyDraftParentPage()
371 {
372 $this->backendUser->uc['copyLevels'] = 10;
373
374 $newTableIds = $this->actionService->createNewRecord(static::TABLE_Page, static::VALUE_PageId, ['title' => 'Testing #1', 'hidden' => 0]);
375 $this->recordIds['newPageId'] = $newTableIds[static::TABLE_Page][0];
376 $newTableIds = $this->actionService->copyRecord(static::TABLE_Page, static::VALUE_PageId, static::VALUE_PageIdTarget);
377 $this->recordIds['copiedPageId'] = $newTableIds[static::TABLE_Page][static::VALUE_PageId];
378 }
379 /**
380 * Creates a page in a draft workspace and copies the parent page in live workspace.
381 */
382 public function createPageAndCopyLiveParentPage()
383 {
384 $this->backendUser->uc['copyLevels'] = 10;
385
386 $newTableIds = $this->actionService->createNewRecord(static::TABLE_Page, static::VALUE_PageId, ['title' => 'Testing #1', 'hidden' => 0]);
387 $this->recordIds['newPageId'] = $newTableIds[static::TABLE_Page][0];
388
389 // Switch to live workspace
390 $this->backendUser->workspace = 0;
391
392 $newTableIds = $this->actionService->copyRecord(static::TABLE_Page, static::VALUE_PageId, static::VALUE_PageIdTarget);
393 $this->recordIds['copiedPageId'] = $newTableIds[static::TABLE_Page][static::VALUE_PageId];
394
395 // Switch back to draft workspace
396 $this->backendUser->workspace = static::VALUE_WorkspaceId;
397 }
398
399 /**
400 * Creates nested pages in a draft workspace and copies the parent page in draft workspace.
401 */
402 public function createNestedPagesAndCopyDraftParentPage()
403 {
404 $this->backendUser->uc['copyLevels'] = 10;
405
406 $newTableIds = $this->actionService->createNewRecord(static::TABLE_Page, static::VALUE_PageId, ['title' => 'Testing #1', 'hidden' => 0]);
407 $this->recordIds['newPageIdFirst'] = $newTableIds[static::TABLE_Page][0];
408 $newTableIds = $this->actionService->createNewRecord(static::TABLE_Page, $this->recordIds['newPageIdFirst'], ['title' => 'Testing #2', 'hidden' => 0]);
409 $this->recordIds['newPageIdSecond'] = $newTableIds[static::TABLE_Page][0];
410 $newTableIds = $this->actionService->copyRecord(static::TABLE_Page, static::VALUE_PageId, static::VALUE_PageIdTarget);
411 $this->recordIds['copiedPageId'] = $newTableIds[static::TABLE_Page][static::VALUE_PageId];
412 $this->recordIds['copiedPageIdFirst'] = $newTableIds[static::TABLE_Page][$this->recordIds['newPageIdFirst']];
413 $this->recordIds['copiedPageIdSecond'] = $newTableIds[static::TABLE_Page][$this->recordIds['newPageIdSecond']];
414 }
415
416 /**
417 * Creates nested pages in a draft workspace and copies the parent page in live workspace.
418 */
419 public function createNestedPagesAndCopyLiveParentPage()
420 {
421 $this->backendUser->uc['copyLevels'] = 10;
422
423 $newTableIds = $this->actionService->createNewRecord(static::TABLE_Page, static::VALUE_PageId, ['title' => 'Testing #1', 'hidden' => 0]);
424 $this->recordIds['newPageIdFirst'] = $newTableIds[static::TABLE_Page][0];
425 $newTableIds = $this->actionService->createNewRecord(static::TABLE_Page, $this->recordIds['newPageIdFirst'], ['title' => 'Testing #2', 'hidden' => 0]);
426 $this->recordIds['newPageIdSecond'] = $newTableIds[static::TABLE_Page][0];
427
428 // Switch to live workspace
429 $this->backendUser->workspace = 0;
430
431 $newTableIds = $this->actionService->copyRecord(static::TABLE_Page, static::VALUE_PageId, static::VALUE_PageIdTarget);
432 $this->recordIds['copiedPageId'] = $newTableIds[static::TABLE_Page][static::VALUE_PageId];
433 $this->recordIds['copiedPageIdFirst'] = $newTableIds[static::TABLE_Page][$this->recordIds['newPageIdFirst']];
434 $this->recordIds['copiedPageIdSecond'] = $newTableIds[static::TABLE_Page][$this->recordIds['newPageIdSecond']];
435
436 // Switch back to draft workspace
437 $this->backendUser->workspace = static::VALUE_WorkspaceId;
438 }
439
440 /**
441 * Deletes a content element and copies the page in draft workspace
442 */
443 public function deleteContentAndCopyDraftPage()
444 {
445 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
446 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
447 $this->recordIds['copiedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
448 }
449
450 /**
451 * Deletes a content element and copies the page in live workspace
452 */
453 public function deleteContentAndCopyLivePage()
454 {
455 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
456
457 // Switch to live workspace
458 $this->backendUser->workspace = 0;
459
460 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
461 $this->recordIds['copiedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
462
463 // Switch back to draft workspace
464 $this->backendUser->workspace = static::VALUE_WorkspaceId;
465 }
466
467 /**
468 * Changes content sorting and copies the page in draft workspace.
469 */
470 public function changeContentSortingAndCopyDraftPage()
471 {
472 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
473 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
474 $this->recordIds['copiedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
475 }
476
477 /**
478 * Changes content sorting and copies the page in live workspace.
479 */
480 public function changeContentSortingAndCopyLivePage()
481 {
482 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
483
484 // Switch to live workspace
485 $this->backendUser->workspace = 0;
486
487 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
488 $this->recordIds['copiedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
489
490 // Switch back to draft workspace
491 $this->backendUser->workspace = static::VALUE_WorkspaceId;
492 }
493
494 /**
495 * Moves content either from and to the current page and copies the page in draft workspace.
496 */
497 public function moveContentAndCopyDraftPage()
498 {
499 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget);
500 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdZero, self::VALUE_PageId);
501 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
502 $this->recordIds['copiedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
503 }
504
505 /**
506 * Moves content either from and to the current page and copies the page in draft workspace.
507 */
508 public function moveContentAndCopyLivePage()
509 {
510 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget);
511 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdZero, self::VALUE_PageId);
512
513 // Switch to live workspace
514 $this->backendUser->workspace = 0;
515
516 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
517 $this->recordIds['copiedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
518
519 // Switch back to draft workspace
520 $this->backendUser->workspace = static::VALUE_WorkspaceId;
521 }
522
523 /**
524 * Creates new and move placeholders for pages and deleted the parent page in draft workspace.
525 */
526 public function createPlaceholdersAndDeleteDraftParentPage()
527 {
528 $this->backendUser->uc['recursiveDelete'] = true;
529
530 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
531 $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_ParentPageId, ['title' => 'Testing #1']);
532 $newTableIds = $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_ParentPageId);
533 $this->recordIds['deletedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_ParentPageId];
534 }
535
536 /**
537 * Creates new and move placeholders for pages and deleted the parent page in live workspace.
538 */
539 public function createPlaceholdersAndDeleteLiveParentPage()
540 {
541 $this->backendUser->uc['recursiveDelete'] = true;
542
543 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
544 $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_ParentPageId, ['title' => 'Testing #1']);
545
546 // Switch to live workspace
547 $this->backendUser->workspace = 0;
548
549 $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_ParentPageId);
550
551 // Switch back to draft workspace
552 $this->backendUser->workspace = static::VALUE_WorkspaceId;
553 }
554 }