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