[BUGFIX] Extbase behaviour concerning workspaces
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / IRRE / ForeignField / Modify / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\ForeignField\Modify;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 require_once dirname(dirname(__FILE__)) . '/AbstractActionTestCase.php';
18
19 /**
20 * Functional test for the DataHandler
21 */
22 class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\ForeignField\AbstractActionTestCase {
23
24 /**
25 * @var string
26 */
27 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/IRRE/ForeignField/Modify/DataSet/';
28
29 /**
30 * Parent content records
31 */
32
33 /**
34 * @test
35 * @see DataSet/Assertion/createParentContentRecord.csv
36 */
37 public function createParentContent() {
38 parent::createParentContent();
39 $this->assertAssertionDataSet('createParentContent');
40
41 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
42 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
43 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
44 }
45
46 /**
47 * @test
48 * @see DataSet/Assertion/modifyParentContentRecord.csv
49 */
50 public function modifyParentContent() {
51 parent::modifyParentContent();
52 $this->assertAssertionDataSet('modifyParentContent');
53
54 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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->assertAssertionDataSet('deleteParentContent');
69
70 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
71 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
72 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
73 }
74
75 /**
76 * @test
77 * @see DataSet/Assertion/deleteParentContentRecordAndDiscardDeletedParentRecord.csv
78 */
79 public function deleteParentContentAndDiscardDeletedParent() {
80 parent::deleteParentContentAndDiscardDeletedParent();
81 $this->assertAssertionDataSet('deleteParentContentNDiscardDeletedParent');
82
83 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
84 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
85 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
86 }
87
88 /**
89 * @test
90 * @see DataSet/Assertion/copyParentContentRecord.csv
91 */
92 public function copyParentContent() {
93 parent::copyParentContent();
94 $this->assertAssertionDataSet('copyParentContent');
95
96 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
97 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
98 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
99 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
100 }
101
102 /**
103 * @test
104 * @see DataSet/copyParentContentToDifferentPage.csv
105 */
106 public function copyParentContentToDifferentPage() {
107 parent::copyParentContentToDifferentPage();
108 $this->assertAssertionDataSet('copyParentContentToDifferentPage');
109
110 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
111 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
112 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
113 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
114 }
115
116 /**
117 * @test
118 * @see DataSet/Assertion/localizeParentContentKeep.csv
119 */
120 public function localizeParentContentInKeepMode() {
121 parent::localizeParentContentInKeepMode();
122 $this->assertAssertionDataSet('localizeParentContentKeep');
123
124 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
125 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
126 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
127 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
128 }
129
130 /**
131 * @test
132 * @see DataSet/Assertion/localizeParentContentWAllChildrenKeep.csv
133 */
134 public function localizeParentContentWithAllChildrenInKeepMode() {
135 parent::localizeParentContentWithAllChildrenInKeepMode();
136 $this->assertAssertionDataSet('localizeParentContentWAllChildrenKeep');
137
138 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
139 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
140 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
141 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
142 }
143
144 /**
145 * @test
146 * @see DataSet/Assertion/localizeParentContentSelect.csv
147 */
148 public function localizeParentContentInSelectMode() {
149 parent::localizeParentContentInSelectMode();
150 $this->assertAssertionDataSet('localizeParentContentSelect');
151
152 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
153 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
154 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
155 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
156 }
157
158 /**
159 * @test
160 * @see DataSet/Assertion/localizeParentContentWAllChildrenSelect.csv
161 */
162 public function localizeParentContentWithAllChildrenInSelectMode() {
163 parent::localizeParentContentWithAllChildrenInSelectMode();
164 $this->assertAssertionDataSet('localizeParentContentWAllChildrenSelect');
165
166 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
167 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
168 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
169 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
170 }
171
172 /**
173 * @test
174 * @see DataSet/Assertion/changeParentContentRecordSorting.csv
175 */
176 public function changeParentContentSorting() {
177 parent::changeParentContentSorting();
178 $this->assertAssertionDataSet('changeParentContentSorting');
179
180 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
181 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
182 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
183 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
184 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
185 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
186 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
187 }
188
189 /**
190 * @test
191 * @see DataSet/Assertion/moveParentContentRecordToDifferentPage.csv
192 */
193 public function moveParentContentToDifferentPage() {
194 parent::moveParentContentToDifferentPage();
195 $this->assertAssertionDataSet('moveParentContentToDifferentPage');
196
197 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
198 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
199 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
200 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
201 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
202 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
203 }
204
205 /**
206 * @test
207 * @see DataSet/Assertion/moveParentContentRecordToDifferentPageAndChangeSorting.csv
208 */
209 public function moveParentContentToDifferentPageAndChangeSorting() {
210 parent::moveParentContentToDifferentPageAndChangeSorting();
211 $this->assertAssertionDataSet('moveParentContentToDifferentPageNChangeSorting');
212
213 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
214 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
215 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2', 'Regular Element #1'));
216 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
217 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
218 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
219 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
220 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
221 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
222 }
223
224 /**
225 * Page records
226 */
227
228 /**
229 * @test
230 * @see DataSet/Assertion/modifyPageRecord.csv
231 */
232 public function modifyPage() {
233 parent::modifyPage();
234 $this->assertAssertionDataSet('modifyPage');
235
236 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
237 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
238 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
239 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
240 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
241 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
242 }
243
244 /**
245 * @test
246 * @see DataSet/Assertion/deletePageRecord.csv
247 */
248 public function deletePage() {
249 parent::deletePage();
250 $this->assertAssertionDataSet('deletePage');
251
252 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId, FALSE);
253 $this->assertContains('RuntimeException', $response->getError());
254 }
255
256 /**
257 * @test
258 * @see DataSet/Assertion/copyPageRecord.csv
259 */
260 public function copyPage() {
261 parent::copyPage();
262 $this->assertAssertionDataSet('copyPage');
263
264 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
265 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
266 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
267 }
268
269 /**
270 * @test
271 * @see DataSet/Assertion/copyPageWHotelBeforeParentContent.csv
272 */
273 public function copyPageWithHotelBeforeParentContent() {
274 parent::copyPageWithHotelBeforeParentContent();
275 $this->assertAssertionDataSet('copyPageWHotelBeforeParentContent');
276
277 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
278 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
279 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
280 }
281
282 /**
283 * IRRE Child Records
284 */
285
286 /**
287 * @test
288 * @see DataSet/Assertion/createParentContentRecordWithHotelAndOfferChildRecords.csv
289 */
290 public function createParentContentWithHotelAndOfferChildren() {
291 parent::createParentContentWithHotelAndOfferChildren();
292 $this->assertAssertionDataSet('createParentContentNHotelNOfferChildren');
293
294 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
295 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
296 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
297 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
298 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
299 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
300 }
301
302 /**
303 * @test
304 * @see DataSet/Assertion/createAndCopyParentContentRecordWithHotelAndOfferChildRecords.csv
305 */
306 public function createAndCopyParentContentWithHotelAndOfferChildren() {
307 parent::createAndCopyParentContentWithHotelAndOfferChildren();
308 $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildren');
309
310 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
311 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
312 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
313 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
314 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
315 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
316 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
317 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentHotel)
318 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
319 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
320 ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['copiedHotelId'])->setRecordField(self::FIELD_HotelOffer)
321 ->setTable(self::TABLE_Offer)->setField('title')->setValues('Offer #1'));
322 }
323
324 /**
325 * @test
326 * @see DataSet/Assertion/createAndCopyParentContentRecordWithHotelAndOfferChildRecordsAndDiscardCopiedParentRecord.csv
327 */
328 public function createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent() {
329 parent::createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent();
330 $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildrenNDiscardCopiedParent');
331
332 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
333 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
334 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
335 }
336
337 /**
338 * @test
339 * @see DataSet/Assertion/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
340 */
341 public function createAndLocalizeParentContentWithHotelAndOfferChildren() {
342 parent::createAndLocalizeParentContentWithHotelAndOfferChildren();
343 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildren');
344
345 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
346 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
347 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
348 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
349 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
350 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
351 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
352 ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
353 ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
354 }
355
356 /**
357 * @test
358 * @see DataSet/Assertion/createNLocalizeParentContentNHotelNOfferChildrenNDiscardCreatedParent.csv
359 */
360 public function createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent() {
361 parent::createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent();
362 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenNDiscardCreatedParent');
363
364 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
365 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
366 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', '[Translate to Dansk:] Testing #1'));
367 }
368
369 /**
370 * @test
371 * @see DataSet/Assertion/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecordsAndDiscardLocalizedParentRecord.csv
372 */
373 public function createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent() {
374 parent::createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent();
375 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenNDiscardLocalizedParent');
376
377 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
378 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
379 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
380 }
381
382 /**
383 * @test
384 * @see DataSet/Assertion/modifyOnlyHotelChildRecord.csv
385 */
386 public function modifyOnlyHotelChild() {
387 parent::modifyOnlyHotelChild();
388 $this->assertAssertionDataSet('modifyOnlyHotelChild');
389
390 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
391 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
392 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
393 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
394 }
395
396 /**
397 * @test
398 * @see DataSet/Assertion/modifyParentRecordAndChangeHotelChildRecordsSorting.csv
399 */
400 public function modifyParentAndChangeHotelChildrenSorting() {
401 parent::modifyParentAndChangeHotelChildrenSorting();
402 $this->assertAssertionDataSet('modifyParentNChangeHotelChildrenSorting');
403
404 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
405 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
406 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
407 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
408 }
409
410 /**
411 * @test
412 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
413 */
414 public function modifyParentWithHotelChild() {
415 parent::modifyParentWithHotelChild();
416 $this->assertAssertionDataSet('modifyParentNHotelChild');
417
418 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
419 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
420 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
421 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
422 }
423
424 /**
425 * @test
426 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecordAndDiscardModifiedParentRecord.csv
427 */
428 public function modifyParentWithHotelChildAndDiscardModifiedParent() {
429 parent::modifyParentWithHotelChildAndDiscardModifiedParent();
430 $this->assertAssertionDataSet('modifyParentNHotelChildNDiscardModifiedParent');
431
432 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
433 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
434 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
435 // Discarding the parent shall not discard the child records
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 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
440 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
441 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
442 }
443
444 /**
445 * @test
446 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecordAndDiscardAllModifiedRecords.csv
447 */
448 public function modifyParentWithHotelChildAndDiscardAll() {
449 parent::modifyParentWithHotelChildAndDiscardAll();
450 $this->assertAssertionDataSet('modifyParentNHotelChildNDiscardAll');
451
452 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
453 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
454 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
455 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
456 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
457 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
458 }
459
460 /**
461 * @test
462 * @see DataSet/Assertion/modifyParentRecordAndAddHotelChildRecord.csv
463 */
464 public function modifyParentAndAddHotelChild() {
465 parent::modifyParentAndAddHotelChild();
466 $this->assertAssertionDataSet('modifyParentNAddHotelChild');
467
468 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
469 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
470 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
471 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
472 }
473
474 /**
475 * @test
476 * @see DataSet/Assertion/modifyParentRecordAndDeleteHotelChildRecord.csv
477 */
478 public function modifyParentAndDeleteHotelChild() {
479 parent::modifyParentAndDeleteHotelChild();
480 $this->assertAssertionDataSet('modifyParentNDeleteHotelChild');
481
482 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
483 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
484 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
485 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
486 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
487 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
488 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
489 }
490
491 /**
492 * @test
493 * @see DataSet/modifyNDiscardNModifyParentWHotelChild.csv
494 */
495 public function modifyAndDiscardAndModifyParentWithHotelChild() {
496 parent::modifyAndDiscardAndModifyParentWithHotelChild();
497 $this->assertAssertionDataSet('modifyNDiscardNModifyParentWHotelChild');
498
499 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
500 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
501 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
502 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
503 ->setTable(self::TABLE_Hotel)->setField('header')->setValues('Testing #1'));
504 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
505 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #2'));
506 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
507 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Testing #2'));
508 }
509
510 }