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