[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / IRRE / ForeignField / Publish / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\ForeignField\Publish;
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/Publish/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->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
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->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
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->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
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 // Actually this is not required, since there's nothing to publish... but it's a test case!
85 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast, FALSE);
86 $this->assertAssertionDataSet('deleteParentContentNDiscardDeletedParent');
87
88 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
89 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
90 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
91 }
92
93 /**
94 * @test
95 * @see DataSet/Assertion/copyParentContentRecord.csv
96 */
97 public function copyParentContent() {
98 parent::copyParentContent();
99 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
100 $this->assertAssertionDataSet('copyParentContent');
101
102 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
103 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
104 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
105 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
106 }
107
108 /**
109 * @test
110 * @see DataSet/copyParentContentToDifferentPage.csv
111 */
112 public function copyParentContentToDifferentPage() {
113 parent::copyParentContentToDifferentPage();
114 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
115 $this->assertAssertionDataSet('copyParentContentToDifferentPage');
116
117 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
118 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
119 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
120 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
121 }
122
123 /**
124 * @test
125 * @see DataSet/localizeParentContentKeep.csv
126 */
127 public function localizeParentContentInKeepMode() {
128 parent::localizeParentContentInKeepMode();
129 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
130 $this->assertAssertionDataSet('localizeParentContentKeep');
131
132 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
133 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
134 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
135 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
136 }
137
138 /**
139 * @test
140 * @see DataSet/localizeParentContentWAllChildrenKeep.csv
141 */
142 public function localizeParentContentWithAllChildrenInKeepMode() {
143 parent::localizeParentContentWithAllChildrenInKeepMode();
144 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
145 $this->assertAssertionDataSet('localizeParentContentWAllChildrenKeep');
146
147 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
148 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
149 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
150 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
151 }
152
153 /**
154 * @test
155 * @see DataSet/localizeParentContentSelect.csv
156 */
157 public function localizeParentContentInSelectMode() {
158 parent::localizeParentContentInSelectMode();
159 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
160 $this->assertAssertionDataSet('localizeParentContentSelect');
161
162 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
163 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
164 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
165 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
166 }
167
168 /**
169 * @test
170 * @see DataSet/localizeParentContentWAllChildrenSelect.csv
171 */
172 public function localizeParentContentWithAllChildrenInSelectMode() {
173 parent::localizeParentContentWithAllChildrenInSelectMode();
174 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
175 $this->assertAssertionDataSet('localizeParentContentWAllChildrenSelect');
176
177 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
178 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
179 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
180 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
181 }
182
183 /**
184 * @test
185 * @see DataSet/Assertion/changeParentContentRecordSorting.csv
186 */
187 public function changeParentContentSorting() {
188 parent::changeParentContentSorting();
189 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
190 $this->assertAssertionDataSet('changeParentContentSorting');
191
192 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
193 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
194 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
195 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
196 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
197 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
198 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
199 }
200
201 /**
202 * @test
203 * @see DataSet/Assertion/moveParentContentRecordToDifferentPage.csv
204 */
205 public function moveParentContentToDifferentPage() {
206 parent::moveParentContentToDifferentPage();
207 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
208 $this->assertAssertionDataSet('moveParentContentToDifferentPage');
209
210 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
211 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
212 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
213
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->publishRecords(
226 array(
227 self::TABLE_Content => array(self::VALUE_ContentIdFirst, self::VALUE_ContentIdLast),
228 )
229 );
230 $this->assertAssertionDataSet('moveParentContentToDifferentPageNChangeSorting');
231
232 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
233 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
234 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2', 'Regular Element #1'));
235 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
236 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
237 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
238 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
239 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
240 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
241 }
242
243 /**
244 * Page records
245 */
246
247 /**
248 * @test
249 * @see DataSet/Assertion/modifyPageRecord.csv
250 */
251 public function modifyPage() {
252 parent::modifyPage();
253 $this->actionService->publishRecord(self::TABLE_Page, self::VALUE_PageId);
254 $this->assertAssertionDataSet('modifyPage');
255
256 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
257 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
258 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
259 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
260 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
261 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
262 }
263
264 /**
265 * @test
266 * @see DataSet/Assertion/deletePageRecord.csv
267 */
268 public function deletePage() {
269 parent::deletePage();
270 $this->actionService->publishRecord(self::TABLE_Page, self::VALUE_PageId);
271 $this->assertAssertionDataSet('deletePage');
272
273 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, FALSE);
274 $this->assertContains('PageNotFoundException', $response->getError());
275 }
276
277 /**
278 * @test
279 * @see DataSet/Assertion/copyPageRecord.csv
280 */
281 public function copyPage() {
282 parent::copyPage();
283 $this->actionService->publishRecords(
284 array(
285 self::TABLE_Page => array($this->recordIds['newPageId']),
286 self::TABLE_Content => array($this->recordIds['newContentIdFirst'], $this->recordIds['newContentIdLast']),
287 )
288 );
289 $this->assertAssertionDataSet('copyPage');
290
291 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
292 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
293 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
294 }
295
296 /**
297 * @test
298 * @see DataSet/Assertion/copyPageWHotelBeforeParentContent.csv
299 */
300 public function copyPageWithHotelBeforeParentContent() {
301 parent::copyPageWithHotelBeforeParentContent();
302 $this->actionService->publishRecords(
303 array(
304 self::TABLE_Page => array($this->recordIds['newPageId']),
305 self::TABLE_Content => array($this->recordIds['newContentIdFirst'], $this->recordIds['newContentIdLast']),
306 )
307 );
308 $this->assertAssertionDataSet('copyPageWHotelBeforeParentContent');
309
310 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
311 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
312 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
313 }
314
315 /**
316 * IRRE Child Records
317 */
318
319 /**
320 * @test
321 * @see DataSet/Assertion/createParentContentRecordWithHotelAndOfferChildRecords.csv
322 */
323 public function createParentContentWithHotelAndOfferChildren() {
324 parent::createParentContentWithHotelAndOfferChildren();
325 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
326 $this->assertAssertionDataSet('createParentContentNHotelNOfferChildren');
327
328 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
329 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
330 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
331 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
332 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
333 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
334 }
335
336 /**
337 * @test
338 * @see DataSet/Assertion/createAndCopyParentContentRecordWithHotelAndOfferChildRecords.csv
339 */
340 public function createAndCopyParentContentWithHotelAndOfferChildren() {
341 parent::createAndCopyParentContentWithHotelAndOfferChildren();
342 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
343 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['copiedContentId']);
344 $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildren');
345
346 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
347 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
348 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
349 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
350 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
351 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
352 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
353 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentHotel)
354 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
355 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
356 ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['copiedHotelId'])->setRecordField(self::FIELD_HotelOffer)
357 ->setTable(self::TABLE_Offer)->setField('title')->setValues('Offer #1'));
358 }
359
360 /**
361 * @test
362 * @see DataSet/Assertion/createAndCopyParentContentRecordWithHotelAndOfferChildRecordsAndDiscardCopiedParentRecord.csv
363 */
364 public function createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent() {
365 parent::createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent();
366 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
367 // Actually this is not required, since there's nothing to publish... but it's a test case!
368 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['copiedContentId'], FALSE);
369 $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildrenNDiscardCopiedParent');
370
371 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
372 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
373 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
374 }
375
376 /**
377 * @test
378 * @see DataSet/Assertion/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
379 */
380 public function createAndLocalizeParentContentWithHotelAndOfferChildren() {
381 parent::createAndLocalizeParentContentWithHotelAndOfferChildren();
382 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
383 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
384 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildren');
385
386 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
387 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
388 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
389 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
390 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
391 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
392 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
393 ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
394 ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
395 }
396
397 /**
398 * @test
399 * @see DataSet/Assertion/createNLocalizeParentContentNHotelNOfferChildrenNDiscardCreatedParent.csv
400 */
401 public function createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent() {
402 parent::createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent();
403 // Actually this is not required, since there's nothing to publish... but it's a test case!
404 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId'], FALSE);
405 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenNDiscardCreatedParent');
406
407 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
408 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
409 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', '[Translate to Dansk:] Testing #1'));
410 }
411
412 /**
413 * @test
414 * @see DataSet/Assertion/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecordsAndDiscardLocalizedParentRecord.csv
415 */
416 public function createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent() {
417 parent::createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent();
418 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
419 // Actually this is not required, since there's nothing to publish... but it's a test case!
420 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId'], FALSE);
421 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenNDiscardLocalizedParent');
422
423 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
424 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
425 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
426 }
427
428 /**
429 * @test
430 * @see DataSet/Assertion/modifyOnlyHotelChildRecord.csv
431 */
432 public function modifyOnlyHotelChild() {
433 parent::modifyOnlyHotelChild();
434 $this->actionService->publishRecord(self::TABLE_Hotel, 4);
435 $this->assertAssertionDataSet('modifyOnlyHotelChild');
436
437 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
438 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
439 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
440 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
441 }
442
443 /**
444 * @test
445 * @see DataSet/Assertion/modifyParentRecordAndChangeHotelChildRecordsSorting.csv
446 */
447 public function modifyParentAndChangeHotelChildrenSorting() {
448 parent::modifyParentAndChangeHotelChildrenSorting();
449 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
450 $this->assertAssertionDataSet('modifyParentNChangeHotelChildrenSorting');
451
452 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
453 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
454 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
455 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
456 }
457
458 /**
459 * @test
460 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
461 */
462 public function modifyParentWithHotelChild() {
463 parent::modifyParentWithHotelChild();
464 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
465 $this->assertAssertionDataSet('modifyParentNHotelChild');
466
467 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
468 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
469 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
470 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
471 }
472
473 /**
474 * @test
475 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecordAndDiscardModifiedParentRecord.csv
476 */
477 public function modifyParentWithHotelChildAndDiscardModifiedParent() {
478 parent::modifyParentWithHotelChildAndDiscardModifiedParent();
479 // Actually this is not required, since there's nothing to publish... but it's a test case!
480 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, FALSE);
481 $this->assertAssertionDataSet('modifyParentNHotelChildNDiscardModifiedParent');
482
483 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
484 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
485 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
486 // Discarding the parent shall not discard the child records
487 // Since the discarded parent does not need to be published, version children are not published as well
488 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
489 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
490 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
491 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
492 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
493 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Testing #1'));
494 }
495
496 /**
497 * @test
498 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecordAndDiscardAllModifiedRecords.csv
499 */
500 public function modifyParentWithHotelChildAndDiscardAll() {
501 parent::modifyParentWithHotelChildAndDiscardAll();
502 // Actually this is not required, since there's nothing to publish... but it's a test case!
503 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, FALSE);
504 $this->assertAssertionDataSet('modifyParentNHotelChildNDiscardAll');
505
506 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
507 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
508 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
509 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
510 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
511 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
512 }
513
514 /**
515 * @test
516 * @see DataSet/Assertion/modifyParentRecordAndAddHotelChildRecord.csv
517 */
518 public function modifyParentAndAddHotelChild() {
519 parent::modifyParentAndAddHotelChild();
520 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
521 $this->assertAssertionDataSet('modifyParentNAddHotelChild');
522
523 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
524 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
525 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
526 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
527 }
528
529 /**
530 * @test
531 * @see DataSet/Assertion/modifyParentRecordAndDeleteHotelChildRecord.csv
532 */
533 public function modifyParentAndDeleteHotelChild() {
534 parent::modifyParentAndDeleteHotelChild();
535 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
536 $this->assertAssertionDataSet('modifyParentNDeleteHotelChild');
537
538 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
539 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
540 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
541 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
542 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
543 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
544 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
545 }
546
547 /**
548 * @test
549 * @see DataSet/modifyNDiscardNModifyParentWHotelChild.csv
550 */
551 public function modifyAndDiscardAndModifyParentWithHotelChild() {
552 parent::modifyAndDiscardAndModifyParentWithHotelChild();
553 $this->actionService->publishRecords(
554 array(
555 self::TABLE_Content => array(self::VALUE_ContentIdFirst),
556 self::TABLE_Hotel => array(3, 4),
557 )
558 );
559 $this->assertAssertionDataSet('modifyNDiscardNModifyParentWHotelChild');
560
561 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
562 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
563 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
564 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
565 ->setTable(self::TABLE_Hotel)->setField('header')->setValues('Testing #1'));
566 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
567 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #2'));
568 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
569 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Testing #2'));
570 }
571
572 }