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