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/CSV/Modify/DataSet/';
26 
35  public function createParentContent()
36  {
37  parent::createParentContent();
38  $this->assertAssertionDataSet('createParentContent');
39 
40  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
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();
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();
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();
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();
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();
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();
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();
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/JsonRendererNoOverlay.ts'
163  ]);
164  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
165  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
166  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['localizedContentId'])->setRecordField(self::FIELD_ContentHotel)
167  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
168  }
169 
175  {
176  parent::localizeParentContentInKeepMode();
177  $this->assertAssertionDataSet('localizeParentContentKeep');
178 
179  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
180  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
181  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
182  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
183  }
184 
190  {
191  parent::localizeParentContentWithAllChildrenInKeepMode();
192  $this->assertAssertionDataSet('localizeParentContentWAllChildrenKeep');
193 
194  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
195  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
196  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
197  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
198  }
199 
205  {
206  parent::localizeParentContentInSelectMode();
207  $this->assertAssertionDataSet('localizeParentContentSelect');
208 
209  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
210  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
211  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
212  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
213  }
214 
220  {
221  parent::localizeParentContentWithAllChildrenInSelectMode();
222  $this->assertAssertionDataSet('localizeParentContentWAllChildrenSelect');
223 
224  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
225  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
226  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
227  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
228  }
229 
234  public function changeParentContentSorting()
235  {
236  parent::changeParentContentSorting();
237  $this->assertAssertionDataSet('changeParentContentSorting');
238 
239  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
240  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
241  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
242  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
243  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
244  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
245  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
246  }
247 
253  {
254  parent::moveParentContentToDifferentPage();
255  $this->assertAssertionDataSet('moveParentContentToDifferentPage');
256 
257  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
258  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
259  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
260  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
261  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
262  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
263  }
264 
270  {
271  parent::moveParentContentToDifferentPageAndChangeSorting();
272  $this->assertAssertionDataSet('moveParentContentToDifferentPageNChangeSorting');
273 
274  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
275  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
276  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2', 'Regular Element #1'));
277  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
278  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
279  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
280  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
281  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
282  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
283  }
284 
293  public function modifyPage()
294  {
295  parent::modifyPage();
296  $this->assertAssertionDataSet('modifyPage');
297 
298  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
299  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
300  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
301  }
302 
307  public function deletePage()
308  {
309  parent::deletePage();
310  $this->assertAssertionDataSet('deletePage');
311 
312  $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, false);
313  $this->assertContains('PageNotFoundException', $response->getError());
314  }
315 
320  public function copyPage()
321  {
322  parent::copyPage();
323  $this->assertAssertionDataSet('copyPage');
324 
325  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
326  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
327  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
328  }
329 
335  {
336  parent::copyPageWithHotelBeforeParentContent();
337  $this->assertAssertionDataSet('copyPageWHotelBeforeParentContent');
338 
339  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
340  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
341  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
342  }
343 
353  {
354  parent::createParentContentWithHotelAndOfferChildren();
355  $this->assertAssertionDataSet('createParentContentNHotelNOfferChildren');
356 
357  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
358  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
359  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
360  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
361  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
362  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
363  }
364 
370  {
371  parent::createAndCopyParentContentWithHotelAndOfferChildren();
372  $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildren');
373 
374  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
375  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
376  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
377  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
378  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
379  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentHotel)
380  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
381  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
382  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['copiedHotelId'])->setRecordField(self::FIELD_HotelOffer)
383  ->setTable(self::TABLE_Offer)->setField('title')->setValues('Offer #1'));
384  }
385 
391  {
392  parent::createAndLocalizeParentContentWithHotelAndOfferChildren();
393  $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildren');
394 
395  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
396  // Content record gets overlaid, thus using newContentId
397  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
398  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
399  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
400  // Content record directly points to localized child, thus using localizedHotelId
401  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
402  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['localizedHotelId'])->setRecordField(self::FIELD_HotelOffer)
403  ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
404  }
405 
410  public function modifyOnlyHotelChild()
411  {
412  parent::modifyOnlyHotelChild();
413  $this->assertAssertionDataSet('modifyOnlyHotelChild');
414 
415  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
416  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
417  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
418  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
419  }
420 
426  {
427  parent::modifyParentAndChangeHotelChildrenSorting();
428  $this->assertAssertionDataSet('modifyParentNChangeHotelChildrenSorting');
429 
430  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
431  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
432  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
433  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
434  }
435 
440  public function modifyParentWithHotelChild()
441  {
442  parent::modifyParentWithHotelChild();
443  $this->assertAssertionDataSet('modifyParentNHotelChild');
444 
445  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
446  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
447  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
448  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
449  }
450 
456  {
457  parent::modifyParentAndAddHotelChild();
458  $this->assertAssertionDataSet('modifyParentNAddHotelChild');
459 
460  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
461  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
462  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
463  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
464  }
465 
471  {
472  parent::modifyParentAndDeleteHotelChild();
473  $this->assertAssertionDataSet('modifyParentNDeleteHotelChild');
474 
475  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
476  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
477  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
478  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
479  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
480  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
481  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
482  }
483 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)
setUpFrontendRootPage($pageId, array $typoScriptFiles=[])