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