[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / IRRE / CSV / PublishAll / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\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\IRRE\CSV\AbstractActionTestCase {
21
22 /**
23 * @var string
24 */
25 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/IRRE/CSV/PublishAll/DataSet/';
26
27 /**
28 * Parent content records
29 */
30
31 protected function setUp() {
32 parent::setUp();
33 }
34
35 /**
36 * @test
37 * @see DataSet/Assertion/createParentContentRecord.csv
38 */
39 public function createParentContent() {
40 parent::createParentContent();
41 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
42 $this->assertAssertionDataSet('createParentContent');
43
44 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
45 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
46 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
47 }
48
49 /**
50 * @test
51 * @see DataSet/Assertion/modifyParentContentRecord.csv
52 */
53 public function modifyParentContent() {
54 parent::modifyParentContent();
55 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
56 $this->assertAssertionDataSet('modifyParentContent');
57
58 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
59 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
60 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
61 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
62 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
63 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
64 }
65
66 /**
67 * @test
68 * @see DataSet/Assertion/deleteParentContentRecord.csv
69 */
70 public function deleteParentContent() {
71 parent::deleteParentContent();
72 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
73 $this->assertAssertionDataSet('deleteParentContent');
74
75 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
76 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
77 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
78 }
79
80 /**
81 * @test
82 * @see DataSet/Assertion/deleteParentContentRecordAndDiscardDeletedParentRecord.csv
83 */
84 public function deleteParentContentAndDiscardDeletedParent() {
85 parent::deleteParentContentAndDiscardDeletedParent();
86 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
87 $this->assertAssertionDataSet('deleteParentContentNDiscardDeletedParent');
88
89 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
90 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
91 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
92 }
93
94 /**
95 * @test
96 * @see DataSet/Assertion/copyParentContentRecord.csv
97 */
98 public function copyParentContent() {
99 parent::copyParentContent();
100 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
101 $this->assertAssertionDataSet('copyParentContent');
102
103 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
104 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
105 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
106 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
107 }
108
109 /**
110 * @test
111 * @see DataSet/copyParentContentToDifferentPage.csv
112 */
113 public function copyParentContentToDifferentPage() {
114 parent::copyParentContentToDifferentPage();
115 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
116 $this->assertAssertionDataSet('copyParentContentToDifferentPage');
117
118 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
119 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
120 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
121 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
122 }
123
124 /**
125 * @test
126 * @see DataSet/localizeParentContentKeep.csv
127 */
128 public function localizeParentContentInKeepMode() {
129 parent::localizeParentContentInKeepMode();
130 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
131 $this->assertAssertionDataSet('localizeParentContentKeep');
132
133 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
134 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
135 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
136 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
137 }
138
139 /**
140 * @test
141 * @see DataSet/localizeParentContentWAllChildrenKeep.csv
142 */
143 public function localizeParentContentWithAllChildrenInKeepMode() {
144 parent::localizeParentContentWithAllChildrenInKeepMode();
145 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
146 $this->assertAssertionDataSet('localizeParentContentWAllChildrenKeep');
147
148 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
149 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
150 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
151 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
152 }
153
154 /**
155 * @test
156 * @see DataSet/localizeParentContentSelect.csv
157 */
158 public function localizeParentContentInSelectMode() {
159 parent::localizeParentContentInSelectMode();
160 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
161 $this->assertAssertionDataSet('localizeParentContentSelect');
162
163 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
164 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
165 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
166 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
167 }
168
169 /**
170 * @test
171 * @see DataSet/localizeParentContentWAllChildrenSelect.csv
172 */
173 public function localizeParentContentWithAllChildrenInSelectMode() {
174 parent::localizeParentContentWithAllChildrenInSelectMode();
175 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
176 $this->assertAssertionDataSet('localizeParentContentWAllChildrenSelect');
177
178 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
179 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
180 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
181 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
182 }
183
184 /**
185 * @test
186 * @see DataSet/Assertion/changeParentContentRecordSorting.csv
187 */
188 public function changeParentContentSorting() {
189 parent::changeParentContentSorting();
190 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
191 $this->assertAssertionDataSet('changeParentContentSorting');
192
193 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
194 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
195 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
196 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
197 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
198 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
199 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
200 }
201
202 /**
203 * @test
204 * @see DataSet/Assertion/moveParentContentRecordToDifferentPage.csv
205 */
206 public function moveParentContentToDifferentPage() {
207 parent::moveParentContentToDifferentPage();
208 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
209 $this->assertAssertionDataSet('moveParentContentToDifferentPage');
210
211 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
212 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
213 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
214 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
215 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
216 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
217 }
218
219 /**
220 * @test
221 * @see DataSet/Assertion/moveParentContentRecordToDifferentPageAndChangeSorting.csv
222 */
223 public function moveParentContentToDifferentPageAndChangeSorting() {
224 parent::moveParentContentToDifferentPageAndChangeSorting();
225 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
226 $this->assertAssertionDataSet('moveParentContentToDifferentPageNChangeSorting');
227
228 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
229 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
230 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2', 'Regular Element #1'));
231 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
232 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
233 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
234 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
235 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
236 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
237 }
238
239 /**
240 * Page records
241 */
242
243 /**
244 * @test
245 * @see DataSet/Assertion/modifyPageRecord.csv
246 */
247 public function modifyPage() {
248 parent::modifyPage();
249 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
250 $this->assertAssertionDataSet('modifyPage');
251
252 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
253 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
254 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
255 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
256 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
257 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
258 }
259
260 /**
261 * @test
262 * @see DataSet/Assertion/deletePageRecord.csv
263 */
264 public function deletePage() {
265 parent::deletePage();
266 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
267 $this->assertAssertionDataSet('deletePage');
268
269 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, FALSE);
270 $this->assertContains('PageNotFoundException', $response->getError());
271 }
272
273 /**
274 * @test
275 * @see DataSet/Assertion/copyPageRecord.csv
276 */
277 public function copyPage() {
278 parent::copyPage();
279 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
280 $this->assertAssertionDataSet('copyPage');
281
282 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
283 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
284 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
285 }
286
287 /**
288 * @test
289 * @see DataSet/Assertion/copyPageWHotelBeforeParentContent.csv
290 */
291 public function copyPageWithHotelBeforeParentContent() {
292 parent::copyPageWithHotelBeforeParentContent();
293 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
294 $this->assertAssertionDataSet('copyPageWHotelBeforeParentContent');
295
296 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
297 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
298 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
299 }
300
301 /**
302 * IRRE Child Records
303 */
304
305 /**
306 * @test
307 * @see DataSet/Assertion/createParentContentRecordWithHotelAndOfferChildRecords.csv
308 */
309 public function createParentContentWithHotelAndOfferChildren() {
310 parent::createParentContentWithHotelAndOfferChildren();
311 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
312 $this->assertAssertionDataSet('createParentContentNHotelNOfferChildren');
313
314 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
315 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
316 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
317 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
318 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
319 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
320 }
321
322 /**
323 * @test
324 * @see DataSet/Assertion/createAndCopyParentContentRecordWithHotelAndOfferChildRecords.csv
325 */
326 public function createAndCopyParentContentWithHotelAndOfferChildren() {
327 parent::createAndCopyParentContentWithHotelAndOfferChildren();
328 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
329 $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildren');
330
331 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
332 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
333 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
334 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
335 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
336 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
337 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
338 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentHotel)
339 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
340 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
341 ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['copiedHotelId'])->setRecordField(self::FIELD_HotelOffer)
342 ->setTable(self::TABLE_Offer)->setField('title')->setValues('Offer #1'));
343 }
344
345 /**
346 * @test
347 * @see DataSet/Assertion/createAndCopyParentContentRecordWithHotelAndOfferChildRecordsAndDiscardCopiedParentRecord.csv
348 */
349 public function createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent() {
350 parent::createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent();
351 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
352 $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildrenNDiscardCopiedParent');
353
354 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
355 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
356 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
357 }
358
359 /**
360 * @test
361 * @see DataSet/Assertion/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
362 */
363 public function createAndLocalizeParentContentWithHotelAndOfferChildren() {
364 parent::createAndLocalizeParentContentWithHotelAndOfferChildren();
365 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
366 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildren');
367
368 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
369 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
370 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
371 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
372 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
373 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
374 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
375 ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['localizedHotelId'])->setRecordField(self::FIELD_HotelOffer)
376 ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
377 }
378
379 /**
380 * @test
381 * @see DataSet/Assertion/createNLocalizeParentContentNHotelNOfferChildrenNDiscardCreatedParent.csv
382 */
383 public function createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent() {
384 parent::createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent();
385 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
386 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenNDiscardCreatedParent');
387
388 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
389 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
390 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', '[Translate to Dansk:] Testing #1'));
391 }
392
393 /**
394 * @test
395 * @see DataSet/Assertion/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecordsAndDiscardLocalizedParentRecord.csv
396 */
397 public function createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent() {
398 parent::createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent();
399 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
400 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenNDiscardLocalizedParent');
401
402 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
403 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
404 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
405 }
406
407 /**
408 * @test
409 * @see DataSet/Assertion/modifyOnlyHotelChildRecord.csv
410 */
411 public function modifyOnlyHotelChild() {
412 parent::modifyOnlyHotelChild();
413 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
414 $this->assertAssertionDataSet('modifyOnlyHotelChild');
415
416 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
417 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
418 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
419 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
420 }
421
422 /**
423 * @test
424 * @see DataSet/Assertion/modifyParentRecordAndChangeHotelChildRecordsSorting.csv
425 */
426 public function modifyParentAndChangeHotelChildrenSorting() {
427 parent::modifyParentAndChangeHotelChildrenSorting();
428 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
429 $this->assertAssertionDataSet('modifyParentNChangeHotelChildrenSorting');
430
431 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
432 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
433 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
434 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
435 }
436
437 /**
438 * @test
439 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
440 */
441 public function modifyParentWithHotelChild() {
442 parent::modifyParentWithHotelChild();
443 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
444 $this->assertAssertionDataSet('modifyParentNHotelChild');
445
446 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
447 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
448 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
449 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
450 }
451
452 /**
453 * @test
454 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecordAndDiscardModifiedParentRecord.csv
455 */
456 public function modifyParentWithHotelChildAndDiscardModifiedParent() {
457 parent::modifyParentWithHotelChildAndDiscardModifiedParent();
458 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
459 $this->assertAssertionDataSet('modifyParentNHotelChildNDiscardModifiedParent');
460
461 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
462 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
463 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
464 // Discarding the parent shall not discard the child records
465 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
466 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
467 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
468 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
469 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
470 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
471 }
472
473 /**
474 * @test
475 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecordAndDiscardAllModifiedRecords.csv
476 */
477 public function modifyParentWithHotelChildAndDiscardAll() {
478 parent::modifyParentWithHotelChildAndDiscardAll();
479 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
480 $this->assertAssertionDataSet('modifyParentNHotelChildNDiscardAll');
481
482 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
483 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
484 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
485 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
486 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
487 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
488 }
489
490 /**
491 * @test
492 * @see DataSet/Assertion/modifyParentRecordAndAddHotelChildRecord.csv
493 */
494 public function modifyParentAndAddHotelChild() {
495 parent::modifyParentAndAddHotelChild();
496 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
497 $this->assertAssertionDataSet('modifyParentNAddHotelChild');
498
499 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
500 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
501 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
502 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
503 }
504
505 /**
506 * @test
507 * @see DataSet/Assertion/modifyParentRecordAndDeleteHotelChildRecord.csv
508 */
509 public function modifyParentAndDeleteHotelChild() {
510 parent::modifyParentAndDeleteHotelChild();
511 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
512 $this->assertAssertionDataSet('modifyParentNDeleteHotelChild');
513
514 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
515 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
516 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
517 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
518 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
519 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
520 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
521 }
522
523 /**
524 * @test
525 * @see DataSet/modifyNDiscardNModifyParentWHotelChild.csv
526 */
527 public function modifyAndDiscardAndModifyParentWithHotelChild() {
528 parent::modifyAndDiscardAndModifyParentWithHotelChild();
529 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
530 $this->assertAssertionDataSet('modifyNDiscardNModifyParentWHotelChild');
531
532 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
533 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
534 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
535 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
536 ->setTable(self::TABLE_Hotel)->setField('header')->setValues('Testing #1'));
537 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
538 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #2'));
539 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
540 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Testing #2'));
541 }
542
543 }