TYPO3 CMS  TYPO3_7-6
ActionTest.php
Go to the documentation of this file.
1 <?php
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 
21 {
25  protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/IRRE/ForeignField/Modify/DataSet/';
26 
35  public function createParentContent()
36  {
37  parent::createParentContent();
38  $this->assertAssertionDataSet('createParentContent');
39 
40  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
41  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
42  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
43  }
44 
49  public function modifyParentContent()
50  {
51  parent::modifyParentContent();
52  $this->assertAssertionDataSet('modifyParentContent');
53 
54  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->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 
66  public function deleteParentContent()
67  {
68  parent::deleteParentContent();
69  $this->assertAssertionDataSet('deleteParentContent');
70 
71  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
72  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
73  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
74  }
75 
80  public function copyParentContent()
81  {
82  parent::copyParentContent();
83  $this->assertAssertionDataSet('copyParentContent');
84 
85  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
86  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
87  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
88  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
89  }
90 
96  {
97  parent::copyParentContentToDifferentPage();
98  $this->assertAssertionDataSet('copyParentContentToDifferentPage');
99 
100  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->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 
111  {
112  parent::copyParentContentToLanguageInKeepMode();
113  $this->assertAssertionDataSet('copyParentContentToLanguageKeep');
114 
115  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
116  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
117  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
118  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
119  }
120 
126  {
127  parent::copyParentContentToLanguageWithAllChildrenInKeepMode();
128  $this->assertAssertionDataSet('copyParentContentToLanguageWAllChildrenKeep');
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 
141  {
142  parent::copyParentContentToLanguageInSelectMode();
143  $this->assertAssertionDataSet('copyParentContentToLanguageSelect');
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 
156  {
157  parent::copyParentContentToLanguageWithAllChildrenInSelectMode();
158  $this->assertAssertionDataSet('copyParentContentToLanguageWAllChildrenSelect');
159 
160  $this->setUpFrontendRootPage(1, [
161  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
162  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/ExtbaseJsonRenderer.ts',
163  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRendererNoOverlay.ts'
164  ]);
165  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
166  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
167  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['localizedContentId'])->setRecordField(self::FIELD_ContentHotel)
168  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
169  }
170 
176  {
177  parent::localizeParentContentInKeepMode();
178  $this->assertAssertionDataSet('localizeParentContentKeep');
179 
180  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
181  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
182  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
183  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
184  }
185 
191  {
192  parent::localizeParentContentWithAllChildrenInKeepMode();
193  $this->assertAssertionDataSet('localizeParentContentWAllChildrenKeep');
194 
195  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
196  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
197  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
198  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
199  }
200 
206  {
207  parent::localizeParentContentInSelectMode();
208  $this->assertAssertionDataSet('localizeParentContentSelect');
209 
210  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
211  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
212  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
213  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
214  }
215 
221  {
222  parent::localizeParentContentWithAllChildrenInSelectMode();
223  $this->assertAssertionDataSet('localizeParentContentWAllChildrenSelect');
224 
225  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
226  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
227  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
228  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
229  }
230 
235  public function changeParentContentSorting()
236  {
237  parent::changeParentContentSorting();
238  $this->assertAssertionDataSet('changeParentContentSorting');
239 
240  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
241  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
242  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
243  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
244  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
245  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
246  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
247  }
248 
254  {
255  parent::moveParentContentToDifferentPage();
256  $this->assertAssertionDataSet('moveParentContentToDifferentPage');
257 
258  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections('Default', 'Extbase:list()');
259  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
260  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
261  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
262  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
263  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
264  }
265 
271  {
272  parent::moveParentContentToDifferentPageAndChangeSorting();
273  $this->assertAssertionDataSet('moveParentContentToDifferentPageNChangeSorting');
274 
275  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections('Default', 'Extbase:list()');
276  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
277  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2', 'Regular Element #1'));
278  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
279  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
280  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
281  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
282  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
283  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
284  }
285 
294  public function modifyPage()
295  {
296  parent::modifyPage();
297  $this->assertAssertionDataSet('modifyPage');
298 
299  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
300  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
301  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
302  }
303 
308  public function deletePage()
309  {
310  parent::deletePage();
311  $this->assertAssertionDataSet('deletePage');
312 
313  $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, false);
314  $this->assertContains('PageNotFoundException', $response->getError());
315  }
316 
321  public function copyPage()
322  {
323  parent::copyPage();
324  $this->assertAssertionDataSet('copyPage');
325 
326  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections('Default', 'Extbase:list()');
327  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
328  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
329  }
330 
336  {
337  parent::copyPageWithHotelBeforeParentContent();
338  $this->assertAssertionDataSet('copyPageWHotelBeforeParentContent');
339 
340  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections('Default', 'Extbase:list()');
341  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
342  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
343  }
344 
354  {
355  parent::createParentContentWithHotelAndOfferChildren();
356  $this->assertAssertionDataSet('createParentContentNHotelNOfferChildren');
357 
358  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
359  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
360  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
361  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
362  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
363  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
364  }
365 
371  {
372  parent::createAndCopyParentContentWithHotelAndOfferChildren();
373  $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildren');
374 
375  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
376  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
377  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
378  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
379  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
380  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentHotel)
381  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
382  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
383  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['copiedHotelId'])->setRecordField(self::FIELD_HotelOffer)
384  ->setTable(self::TABLE_Offer)->setField('title')->setValues('Offer #1'));
385  }
386 
392  {
393  parent::createAndLocalizeParentContentWithHotelAndOfferChildren();
394  $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildren');
395 
396  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
397  // Content record gets overlaid, thus using newContentId
398  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
399  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
400  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
401  // Hotel record gets overlaid, thus using newHotelId
402  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
403  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
404  ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
405  }
406 
412  {
413  parent::createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration();
414  $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenWOSortBy');
415 
416  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
417  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
418  ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
419  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
420  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
421  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
422  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
423  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
424  ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
425  }
426 
431  public function modifyOnlyHotelChild()
432  {
433  parent::modifyOnlyHotelChild();
434  $this->assertAssertionDataSet('modifyOnlyHotelChild');
435 
436  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
437  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
438  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
439  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
440  }
441 
447  {
448  parent::modifyParentAndChangeHotelChildrenSorting();
449  $this->assertAssertionDataSet('modifyParentNChangeHotelChildrenSorting');
450 
451  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
452  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
453  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
454  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
455  }
456 
461  public function modifyParentWithHotelChild()
462  {
463  parent::modifyParentWithHotelChild();
464  $this->assertAssertionDataSet('modifyParentNHotelChild');
465 
466  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
467  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
468  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
469  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
470  }
471 
477  {
478  parent::modifyParentAndAddHotelChild();
479  $this->assertAssertionDataSet('modifyParentNAddHotelChild');
480 
481  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
482  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
483  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
484  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
485  }
486 
492  {
493  parent::modifyParentAndDeleteHotelChild();
494  $this->assertAssertionDataSet('modifyParentNDeleteHotelChild');
495 
496  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
497  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
498  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
499  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
500  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
501  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
502  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
503  }
504 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)
setUpFrontendRootPage($pageId, array $typoScriptFiles=[])