[CLEANUP] Remove obsolete require_once from test files
[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 /**
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/Modify/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->assertAssertionDataSet('createParentContent');
38
39 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
40 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
41 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
42 }
43
44 /**
45 * @test
46 * @see DataSet/Assertion/modifyParentContentRecord.csv
47 */
48 public function modifyParentContent() {
49 parent::modifyParentContent();
50 $this->assertAssertionDataSet('modifyParentContent');
51
52 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
53 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
54 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
55 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
56 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
57 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
58 }
59
60 /**
61 * @test
62 * @see DataSet/Assertion/deleteParentContentRecord.csv
63 */
64 public function deleteParentContent() {
65 parent::deleteParentContent();
66 $this->assertAssertionDataSet('deleteParentContent');
67
68 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
69 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
70 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
71 }
72
73 /**
74 * @test
75 * @see DataSet/Assertion/deleteParentContentRecordAndDiscardDeletedParentRecord.csv
76 */
77 public function deleteParentContentAndDiscardDeletedParent() {
78 parent::deleteParentContentAndDiscardDeletedParent();
79 $this->assertAssertionDataSet('deleteParentContentNDiscardDeletedParent');
80
81 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
82 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
83 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
84 }
85
86 /**
87 * @test
88 * @see DataSet/Assertion/copyParentContentRecord.csv
89 */
90 public function copyParentContent() {
91 parent::copyParentContent();
92 $this->assertAssertionDataSet('copyParentContent');
93
94 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
95 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
96 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
97 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
98 }
99
100 /**
101 * @test
102 * @see DataSet/copyParentContentToDifferentPage.csv
103 */
104 public function copyParentContentToDifferentPage() {
105 parent::copyParentContentToDifferentPage();
106 $this->assertAssertionDataSet('copyParentContentToDifferentPage');
107
108 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
109 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
110 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
111 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
112 }
113
114 /**
115 * @test
116 * @see DataSet/Assertion/localizeParentContentKeep.csv
117 */
118 public function localizeParentContentInKeepMode() {
119 parent::localizeParentContentInKeepMode();
120 $this->assertAssertionDataSet('localizeParentContentKeep');
121
122 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
123 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
124 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
125 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
126 }
127
128 /**
129 * @test
130 * @see DataSet/Assertion/localizeParentContentWAllChildrenKeep.csv
131 */
132 public function localizeParentContentWithAllChildrenInKeepMode() {
133 parent::localizeParentContentWithAllChildrenInKeepMode();
134 $this->assertAssertionDataSet('localizeParentContentWAllChildrenKeep');
135
136 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
137 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
138 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
139 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
140 }
141
142 /**
143 * @test
144 * @see DataSet/Assertion/localizeParentContentSelect.csv
145 */
146 public function localizeParentContentInSelectMode() {
147 parent::localizeParentContentInSelectMode();
148 $this->assertAssertionDataSet('localizeParentContentSelect');
149
150 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
151 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
152 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
153 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
154 }
155
156 /**
157 * @test
158 * @see DataSet/Assertion/localizeParentContentWAllChildrenSelect.csv
159 */
160 public function localizeParentContentWithAllChildrenInSelectMode() {
161 parent::localizeParentContentWithAllChildrenInSelectMode();
162 $this->assertAssertionDataSet('localizeParentContentWAllChildrenSelect');
163
164 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
165 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
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/Assertion/changeParentContentRecordSorting.csv
173 */
174 public function changeParentContentSorting() {
175 parent::changeParentContentSorting();
176 $this->assertAssertionDataSet('changeParentContentSorting');
177
178 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
179 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
180 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
181 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
182 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
183 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
184 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
185 }
186
187 /**
188 * @test
189 * @see DataSet/Assertion/moveParentContentRecordToDifferentPage.csv
190 */
191 public function moveParentContentToDifferentPage() {
192 parent::moveParentContentToDifferentPage();
193 $this->assertAssertionDataSet('moveParentContentToDifferentPage');
194
195 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
196 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
197 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #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/moveParentContentRecordToDifferentPageAndChangeSorting.csv
206 */
207 public function moveParentContentToDifferentPageAndChangeSorting() {
208 parent::moveParentContentToDifferentPageAndChangeSorting();
209 $this->assertAssertionDataSet('moveParentContentToDifferentPageNChangeSorting');
210
211 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
212 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
213 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2', 'Regular Element #1'));
214 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
215 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
216 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
217 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
218 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
219 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
220 }
221
222 /**
223 * Page records
224 */
225
226 /**
227 * @test
228 * @see DataSet/Assertion/modifyPageRecord.csv
229 */
230 public function modifyPage() {
231 parent::modifyPage();
232 $this->assertAssertionDataSet('modifyPage');
233
234 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
235 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
236 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
237 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
238 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
239 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
240 }
241
242 /**
243 * @test
244 * @see DataSet/Assertion/deletePageRecord.csv
245 */
246 public function deletePage() {
247 parent::deletePage();
248 $this->assertAssertionDataSet('deletePage');
249
250 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId, FALSE);
251 $this->assertContains('RuntimeException', $response->getError());
252 }
253
254 /**
255 * @test
256 * @see DataSet/Assertion/copyPageRecord.csv
257 */
258 public function copyPage() {
259 parent::copyPage();
260 $this->assertAssertionDataSet('copyPage');
261
262 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
263 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
264 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
265 }
266
267 /**
268 * @test
269 * @see DataSet/Assertion/copyPageWHotelBeforeParentContent.csv
270 */
271 public function copyPageWithHotelBeforeParentContent() {
272 parent::copyPageWithHotelBeforeParentContent();
273 $this->assertAssertionDataSet('copyPageWHotelBeforeParentContent');
274
275 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
276 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
277 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
278 }
279
280 /**
281 * IRRE Child Records
282 */
283
284 /**
285 * @test
286 * @see DataSet/Assertion/createParentContentRecordWithHotelAndOfferChildRecords.csv
287 */
288 public function createParentContentWithHotelAndOfferChildren() {
289 parent::createParentContentWithHotelAndOfferChildren();
290 $this->assertAssertionDataSet('createParentContentNHotelNOfferChildren');
291
292 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
293 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
294 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
295 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
296 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
297 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
298 }
299
300 /**
301 * @test
302 * @see DataSet/Assertion/createAndCopyParentContentRecordWithHotelAndOfferChildRecords.csv
303 */
304 public function createAndCopyParentContentWithHotelAndOfferChildren() {
305 parent::createAndCopyParentContentWithHotelAndOfferChildren();
306 $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildren');
307
308 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
309 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
310 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
311 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
312 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
313 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
314 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
315 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentHotel)
316 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
317 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
318 ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['copiedHotelId'])->setRecordField(self::FIELD_HotelOffer)
319 ->setTable(self::TABLE_Offer)->setField('title')->setValues('Offer #1'));
320 }
321
322 /**
323 * @test
324 * @see DataSet/Assertion/createAndCopyParentContentRecordWithHotelAndOfferChildRecordsAndDiscardCopiedParentRecord.csv
325 */
326 public function createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent() {
327 parent::createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent();
328 $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildrenNDiscardCopiedParent');
329
330 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
331 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
332 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
333 }
334
335 /**
336 * @test
337 * @see DataSet/Assertion/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecords.csv
338 */
339 public function createAndLocalizeParentContentWithHotelAndOfferChildren() {
340 parent::createAndLocalizeParentContentWithHotelAndOfferChildren();
341 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildren');
342
343 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
344 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
345 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
346 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
347 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
348 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
349 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
350 ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
351 ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
352 }
353
354 /**
355 * @test
356 * @see DataSet/Assertion/createNLocalizeParentContentNHotelNOfferChildrenNDiscardCreatedParent.csv
357 */
358 public function createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent() {
359 parent::createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent();
360 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenNDiscardCreatedParent');
361
362 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
363 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
364 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', '[Translate to Dansk:] Testing #1'));
365 }
366
367 /**
368 * @test
369 * @see DataSet/Assertion/createAndLocalizeParentContentRecordWithHotelAndOfferChildRecordsAndDiscardLocalizedParentRecord.csv
370 */
371 public function createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent() {
372 parent::createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent();
373 $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenNDiscardLocalizedParent');
374
375 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
376 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
377 ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
378 }
379
380 /**
381 * @test
382 * @see DataSet/Assertion/modifyOnlyHotelChildRecord.csv
383 */
384 public function modifyOnlyHotelChild() {
385 parent::modifyOnlyHotelChild();
386 $this->assertAssertionDataSet('modifyOnlyHotelChild');
387
388 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
389 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
390 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
391 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
392 }
393
394 /**
395 * @test
396 * @see DataSet/Assertion/modifyParentRecordAndChangeHotelChildRecordsSorting.csv
397 */
398 public function modifyParentAndChangeHotelChildrenSorting() {
399 parent::modifyParentAndChangeHotelChildrenSorting();
400 $this->assertAssertionDataSet('modifyParentNChangeHotelChildrenSorting');
401
402 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
403 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
404 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
405 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
406 }
407
408 /**
409 * @test
410 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
411 */
412 public function modifyParentWithHotelChild() {
413 parent::modifyParentWithHotelChild();
414 $this->assertAssertionDataSet('modifyParentNHotelChild');
415
416 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
417 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
418 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
419 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
420 }
421
422 /**
423 * @test
424 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecordAndDiscardModifiedParentRecord.csv
425 */
426 public function modifyParentWithHotelChildAndDiscardModifiedParent() {
427 parent::modifyParentWithHotelChildAndDiscardModifiedParent();
428 $this->assertAssertionDataSet('modifyParentNHotelChildNDiscardModifiedParent');
429
430 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
431 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
432 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
433 // Discarding the parent shall not discard the child records
434 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
435 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
436 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
437 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
438 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
439 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
440 }
441
442 /**
443 * @test
444 * @see DataSet/Assertion/modifyParentRecordWithHotelChildRecordAndDiscardAllModifiedRecords.csv
445 */
446 public function modifyParentWithHotelChildAndDiscardAll() {
447 parent::modifyParentWithHotelChildAndDiscardAll();
448 $this->assertAssertionDataSet('modifyParentNHotelChildNDiscardAll');
449
450 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
451 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
452 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
453 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
454 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
455 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
456 }
457
458 /**
459 * @test
460 * @see DataSet/Assertion/modifyParentRecordAndAddHotelChildRecord.csv
461 */
462 public function modifyParentAndAddHotelChild() {
463 parent::modifyParentAndAddHotelChild();
464 $this->assertAssertionDataSet('modifyParentNAddHotelChild');
465
466 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
467 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
468 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
469 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
470 }
471
472 /**
473 * @test
474 * @see DataSet/Assertion/modifyParentRecordAndDeleteHotelChildRecord.csv
475 */
476 public function modifyParentAndDeleteHotelChild() {
477 parent::modifyParentAndDeleteHotelChild();
478 $this->assertAssertionDataSet('modifyParentNDeleteHotelChild');
479
480 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
481 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
482 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
483 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
484 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
485 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
486 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
487 }
488
489 /**
490 * @test
491 * @see DataSet/modifyNDiscardNModifyParentWHotelChild.csv
492 */
493 public function modifyAndDiscardAndModifyParentWithHotelChild() {
494 parent::modifyAndDiscardAndModifyParentWithHotelChild();
495 $this->assertAssertionDataSet('modifyNDiscardNModifyParentWHotelChild');
496
497 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections('Default', 'Extbase:list()');
498 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
499 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
500 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
501 ->setTable(self::TABLE_Hotel)->setField('header')->setValues('Testing #1'));
502 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
503 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #2'));
504 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
505 ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Testing #2'));
506 }
507
508 }