a43408812927f620e9d7123a28a6f9243ebba5ba
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / Regular / PublishAll / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Regular\PublishAll;
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 class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Regular\AbstractActionTestCase
21 {
22 /**
23 * @var string
24 */
25 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/';
26
27 /**
28 * Content records
29 */
30
31 /**
32 * @test
33 * @see DataSet/createContentRecords.csv
34 */
35 public function createContents()
36 {
37 parent::createContents();
38 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
39 $this->assertAssertionDataSet('createContents');
40
41 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
42 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
43 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', 'Testing #2'));
44 }
45
46 /**
47 * @test
48 * @see DataSet/createContentRecordAndDiscardCreatedContentRecord.csv
49 */
50 public function createContentAndDiscardCreatedContent()
51 {
52 parent::createContentAndDiscardCreatedContent();
53 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
54 $this->assertAssertionDataSet('createContentNDiscardCreatedContent');
55
56 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
57 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
58 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
59 }
60
61 /**
62 * @test
63 * @see DataSet/createAndCopyContentRecordAndDiscardCopiedContentRecord.csv
64 */
65 public function createAndCopyContentAndDiscardCopiedContent()
66 {
67 parent::createAndCopyContentAndDiscardCopiedContent();
68 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
69 $this->assertAssertionDataSet('createNCopyContentNDiscardCopiedContent');
70
71 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
72 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
73 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
74 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
75 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
76 }
77
78 /**
79 * @test
80 * @see DataSet/modifyContentRecord.csv
81 */
82 public function modifyContent()
83 {
84 parent::modifyContent();
85 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
86 $this->assertAssertionDataSet('modifyContent');
87
88 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
89 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
90 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
91 }
92
93 /**
94 * @test
95 * @see DataSet/deleteContentRecord.csv
96 */
97 public function deleteContent()
98 {
99 parent::deleteContent();
100 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
101 $this->assertAssertionDataSet('deleteContent');
102
103 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
104 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
105 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
106 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
107 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
108 }
109
110 /**
111 * @test
112 * @see DataSet/deleteLocalizedContentNDeleteContent.csv
113 */
114 public function deleteLocalizedContentAndDeleteContent()
115 {
116 parent::deleteLocalizedContentAndDeleteContent();
117 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
118 $this->assertAssertionDataSet('deleteLocalizedContentNDeleteContent');
119
120 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
121 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
122 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #3', '[Translate to Dansk:] Regular Element #3'));
123 }
124
125 /**
126 * @test
127 * @see DataSet/copyContentRecord.csv
128 */
129 public function copyContent()
130 {
131 parent::copyContent();
132 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
133 $this->assertAssertionDataSet('copyContent');
134
135 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
136 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
137 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
138 }
139
140 /**
141 * @test
142 * @see DataSet/copyContentToLanguage.csv
143 */
144 public function copyContentToLanguage()
145 {
146 parent::copyContentToLanguage();
147 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
148 $this->assertAssertionDataSet('copyContentToLanguage');
149
150 $this->setUpFrontendRootPage(1, [
151 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
152 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRendererNoOverlay.ts'
153 ]);
154 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
155 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
156 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Regular Element #3', '[Translate to Dansk:] Regular Element #2'));
157 }
158
159 /**
160 * @test
161 * @see DataSet/copyContentToLanguageFromNonDefaultLanguage.csv
162 */
163 public function copyContentToLanguageFromNonDefaultLanguage()
164 {
165 parent::copyContentToLanguageFromNonDefaultLanguage();
166 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
167 $this->assertAssertionDataSet('copyContentToLanguageFromNonDefaultLanguage');
168
169 $this->setUpFrontendRootPage(1, [
170 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
171 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRendererNoOverlay.ts'
172 ]);
173 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageIdSecond)->getResponseSections();
174 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
175 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Deutsch:] [Translate to Dansk:] Regular Element #3'));
176 }
177
178 /**
179 * @test
180 * @see DataSet/localizeContentRecord.csv
181 */
182 public function localizeContent()
183 {
184 parent::localizeContent();
185 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
186 $this->assertAssertionDataSet('localizeContent');
187
188 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
189 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
190 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
191 }
192
193 /**
194 * @test
195 * @see DataSet/localizeContentFromNonDefaultLanguage.csv
196 */
197 public function localizeContentFromNonDefaultLanguage()
198 {
199 parent::localizeContentFromNonDefaultLanguage();
200 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
201 $this->assertAssertionDataSet('localizeContentFromNonDefaultLanguage');
202
203 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageIdSecond)->getResponseSections();
204 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
205 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Deutsch:] [Translate to Dansk:] Regular Element #3'));
206 }
207
208 /**
209 * @test
210 * @see DataSet/changeContentRecordSorting.csv
211 */
212 public function changeContentSorting()
213 {
214 parent::changeContentSorting();
215 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
216 $this->assertAssertionDataSet('changeContentSorting');
217
218 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
219 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
220 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
221 }
222
223 /**
224 * @test
225 * @see DataSet/moveContentRecordToDifferentPage.csv
226 */
227 public function moveContentToDifferentPage()
228 {
229 parent::moveContentToDifferentPage();
230 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
231 $this->assertAssertionDataSet('moveContentToDifferentPage');
232
233 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
234 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
235 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
236 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
237 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
238 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
239 }
240
241 /**
242 * @test
243 * @see DataSet/moveContentRecordToDifferentPageAndChangeSorting.csv
244 */
245 public function moveContentToDifferentPageAndChangeSorting()
246 {
247 parent::moveContentToDifferentPageAndChangeSorting();
248 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
249 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
250
251 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
252 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
253 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
254 }
255
256 /**
257 * Page records
258 */
259
260 /**
261 * @test
262 * @see DataSet/createPageRecord.csv
263 */
264 public function createPage()
265 {
266 parent::createPage();
267 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
268 $this->assertAssertionDataSet('createPage');
269
270 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
271 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
272 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
273 }
274
275 /**
276 * @test
277 * @see DataSet/modifyPageRecord.csv
278 */
279 public function modifyPage()
280 {
281 parent::modifyPage();
282 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
283 $this->assertAssertionDataSet('modifyPage');
284
285 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
286 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
287 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
288 }
289
290 /**
291 * @test
292 * @see DataSet/deletePageRecord.csv
293 */
294 public function deletePage()
295 {
296 parent::deletePage();
297 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
298 $this->assertAssertionDataSet('deletePage');
299
300 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, false);
301 $this->assertContains('PageNotFoundException', $response->getError());
302 }
303
304 /**
305 * @test
306 * @see DataSet/deleteContentAndPage.csv
307 */
308 public function deleteContentAndPage()
309 {
310 parent::deleteContentAndPage();
311 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
312 $this->assertAssertionDataSet('deleteContentAndPage');
313
314 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, false);
315 $this->assertContains('PageNotFoundException', $response->getError());
316 }
317
318 /**
319 * @test
320 * @see DataSet/copyPageRecord.csv
321 */
322 public function copyPage()
323 {
324 parent::copyPage();
325 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
326 $this->assertAssertionDataSet('copyPage');
327
328 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
329 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
330 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
331 }
332
333 /**
334 * @test
335 * @see DataSet/copyPageFreeMode.csv
336 */
337 public function copyPageFreeMode()
338 {
339 $this->importScenarioDataSet('LivePageFreeModeElements');
340 parent::copyPageFreeMode();
341 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
342 $this->assertAssertionDataSet('copyPageFreeMode');
343
344 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
345 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
346 ->setTable(self::TABLE_Page)->setField('title')->setValues('Target'));
347 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
348 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #10'));
349 }
350
351 /**
352 * @test
353 * @see DataSet/localizePageRecord.csv
354 */
355 public function localizePage()
356 {
357 parent::localizePage();
358 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
359 $this->assertAssertionDataSet('localizePage');
360
361 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
362 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
363 ->setTable(self::TABLE_Page)->setField('title')->setValues('[Translate to Dansk:] Relations'));
364 }
365
366 /**
367 * @test
368 * @see DataSet/changePageRecordSorting.csv
369 */
370 public function changePageSorting()
371 {
372 parent::changePageSorting();
373 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
374 $this->assertAssertionDataSet('changePageSorting');
375
376 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
377 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
378 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
379 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
380 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
381 }
382
383 /**
384 * @test
385 * @see DataSet/movePageRecordToDifferentPage.csv
386 */
387 public function movePageToDifferentPage()
388 {
389 parent::movePageToDifferentPage();
390 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
391 $this->assertAssertionDataSet('movePageToDifferentPage');
392
393 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
394 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
395 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
396 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
397 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
398 }
399
400 /**
401 * @test
402 * @see DataSet/movePageRecordToDifferentPageAndChangeSorting.csv
403 */
404 public function movePageToDifferentPageAndChangeSorting()
405 {
406 parent::movePageToDifferentPageAndChangeSorting();
407 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
408 $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
409
410 $responseSectionsPage = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
411 $this->assertThat($responseSectionsPage, $this->getRequestSectionHasRecordConstraint()
412 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
413 $this->assertThat($responseSectionsPage, $this->getRequestSectionHasRecordConstraint()
414 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
415 $responseSectionsWebsite = $this->getFrontendResponse(self::VALUE_PageIdWebsite, 0)->getResponseSections();
416 $this->assertThat($responseSectionsWebsite, $this->getRequestSectionStructureHasRecordConstraint()
417 ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageIdWebsite)->setRecordField('__pages')
418 ->setTable(self::TABLE_Page)->setField('title')->setValues('Target', 'Relations', 'DataHandlerTest'));
419 }
420
421 /**
422 * @test
423 * @see DataSet/movePageRecordToDifferentPageAndCreatePageRecordAfterMovedPageRecord.csv
424 * @see http://forge.typo3.org/issues/33104
425 * @see http://forge.typo3.org/issues/55573
426 */
427 public function movePageToDifferentPageAndCreatePageAfterMovedPage()
428 {
429 parent::movePageToDifferentPageAndCreatePageAfterMovedPage();
430 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
431 $this->assertAssertionDataSet('movePageToDifferentPageNCreatePageAfterMovedPage');
432
433 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdWebsite, 0)->getResponseSections();
434 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
435 ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageIdWebsite)->setRecordField('__pages')
436 ->setTable(self::TABLE_Page)->setField('title')->setValues('Target', 'Testing #1', 'DataHandlerTest'));
437 }
438
439 /**
440 * @test
441 * @see DataSet/createPlaceholdersAndDeleteDraftParentPage.csv
442 */
443 public function createPlaceholdersAndDeleteDraftParentPage()
444 {
445 parent::createPlaceholdersAndDeleteDraftParentPage();
446 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
447 $this->assertAssertionDataSet('createPlaceholdersAndDeleteDraftParentPage');
448 }
449
450 /**
451 * @test
452 * @see DataSet/createPlaceholdersAndDeleteLiveParentPage.csv
453 */
454 public function createPlaceholdersAndDeleteLiveParentPage()
455 {
456 parent::createPlaceholdersAndDeleteLiveParentPage();
457 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
458 $this->assertAssertionDataSet('createPlaceholdersAndDeleteLiveParentPage');
459 }
460 }