TYPO3 CMS  TYPO3_6-2
ActionTest.php
Go to the documentation of this file.
1 <?php
3 
17 require_once dirname(dirname(__FILE__)) . '/AbstractActionTestCase.php';
18 
23 
27  protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/IRRE/ForeignField/Modify/DataSet/';
28 
37  public function createParentContent() {
38  parent::createParentContent();
39  $this->assertAssertionDataSet('createParentContent');
40 
41  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
42  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
43  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
44  }
45 
50  public function modifyParentContent() {
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  parent::deleteParentContent();
68  $this->assertAssertionDataSet('deleteParentContent');
69 
70  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
71  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
72  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
73  }
74 
79  public function copyParentContent() {
80  parent::copyParentContent();
81  $this->assertAssertionDataSet('copyParentContent');
82 
83  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
84  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
85  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
86  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
87  }
88 
94  parent::copyParentContentToDifferentPage();
95  $this->assertAssertionDataSet('copyParentContentToDifferentPage');
96 
97  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections('Default', 'Extbase:list()');
98  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
99  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
100  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
101  }
102 
108  parent::localizeParentContentInKeepMode();
109  $this->assertAssertionDataSet('localizeParentContentKeep');
110 
111  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
112  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
113  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
114  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
115  }
116 
122  parent::localizeParentContentWithAllChildrenInKeepMode();
123  $this->assertAssertionDataSet('localizeParentContentWAllChildrenKeep');
124 
125  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
126  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
127  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
128  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
129  }
130 
136  parent::localizeParentContentInSelectMode();
137  $this->assertAssertionDataSet('localizeParentContentSelect');
138 
139  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
140  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
141  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
142  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
143  }
144 
150  parent::localizeParentContentWithAllChildrenInSelectMode();
151  $this->assertAssertionDataSet('localizeParentContentWAllChildrenSelect');
152 
153  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
154  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
155  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
156  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
157  }
158 
163  public function changeParentContentSorting() {
164  parent::changeParentContentSorting();
165  $this->assertAssertionDataSet('changeParentContentSorting');
166 
167  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
168  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
169  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
170  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
171  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
172  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
173  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
174  }
175 
181  parent::moveParentContentToDifferentPage();
182  $this->assertAssertionDataSet('moveParentContentToDifferentPage');
183 
184  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections('Default', 'Extbase:list()');
185  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
186  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
187  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
188  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
189  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
190  }
191 
197  parent::moveParentContentToDifferentPageAndChangeSorting();
198  $this->assertAssertionDataSet('moveParentContentToDifferentPageNChangeSorting');
199 
200  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections('Default', 'Extbase:list()');
201  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
202  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2', 'Regular Element #1'));
203  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
204  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
205  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
206  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
207  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
208  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
209  }
210 
219  public function modifyPage() {
220  parent::modifyPage();
221  $this->assertAssertionDataSet('modifyPage');
222 
223  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
224  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
225  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
226  }
227 
232  public function deletePage() {
233  parent::deletePage();
234  $this->assertAssertionDataSet('deletePage');
235 
236  $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, FALSE);
237  $this->assertContains('PageNotFoundException', $response->getError());
238  }
239 
244  public function copyPage() {
245  parent::copyPage();
246  $this->assertAssertionDataSet('copyPage');
247 
248  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections('Default', 'Extbase:list()');
249  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
250  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
251  }
252 
258  parent::copyPageWithHotelBeforeParentContent();
259  $this->assertAssertionDataSet('copyPageWHotelBeforeParentContent');
260 
261  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections('Default', 'Extbase:list()');
262  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
263  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
264  }
265 
275  parent::createParentContentWithHotelAndOfferChildren();
276  $this->assertAssertionDataSet('createParentContentNHotelNOfferChildren');
277 
278  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
279  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
280  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
281  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
282  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
283  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
284  }
285 
291  parent::createAndCopyParentContentWithHotelAndOfferChildren();
292  $this->assertAssertionDataSet('createNCopyParentContentNHotelNOfferChildren');
293 
294  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
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  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
299  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentHotel)
300  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
301  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
302  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['copiedHotelId'])->setRecordField(self::FIELD_HotelOffer)
303  ->setTable(self::TABLE_Offer)->setField('title')->setValues('Offer #1'));
304  }
305 
311  parent::createAndLocalizeParentContentWithHotelAndOfferChildren();
312  $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildren');
313 
314  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
315  // Content record gets overlaid, thus using newContentId
316  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
317  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
318  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
319  // Hotel record gets overlaid, thus using newHotelId
320  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
321  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
322  ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
323  }
324 
330  parent::createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration();
331  $this->assertAssertionDataSet('createNLocalizeParentContentNHotelNOfferChildrenWOSortBy');
332 
333  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections('Default', 'Extbase:list()');
334  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
335  ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
336  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
337  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
338  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
339  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
340  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
341  ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
342  }
343 
348  public function modifyOnlyHotelChild() {
349  parent::modifyOnlyHotelChild();
350  $this->assertAssertionDataSet('modifyOnlyHotelChild');
351 
352  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
353  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
354  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
355  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
356  }
357 
363  parent::modifyParentAndChangeHotelChildrenSorting();
364  $this->assertAssertionDataSet('modifyParentNChangeHotelChildrenSorting');
365 
366  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
367  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
368  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
369  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
370  }
371 
376  public function modifyParentWithHotelChild() {
377  parent::modifyParentWithHotelChild();
378  $this->assertAssertionDataSet('modifyParentNHotelChild');
379 
380  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
381  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
382  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
383  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
384  }
385 
390  public function modifyParentAndAddHotelChild() {
391  parent::modifyParentAndAddHotelChild();
392  $this->assertAssertionDataSet('modifyParentNAddHotelChild');
393 
394  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
395  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
396  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
397  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
398  }
399 
405  parent::modifyParentAndDeleteHotelChild();
406  $this->assertAssertionDataSet('modifyParentNDeleteHotelChild');
407 
408  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections('Default', 'Extbase:list()');
409  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
410  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
411  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
412  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
413  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
414  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
415  }
416 
417 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=TRUE)