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