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/CSV/Modify/DataSet/';
28 
37  public function createParentContent() {
38  parent::createParentContent();
39  $this->assertAssertionDataSet('createParentContent');
40 
41  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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  // Content record directly points to localized child, thus using localizedHotelId
320  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
321  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['localizedHotelId'])->setRecordField(self::FIELD_HotelOffer)
322  ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
323  }
324 
329  public function modifyOnlyHotelChild() {
330  parent::modifyOnlyHotelChild();
331  $this->assertAssertionDataSet('modifyOnlyHotelChild');
332 
333  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
334  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
335  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
336  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
337  }
338 
344  parent::modifyParentAndChangeHotelChildrenSorting();
345  $this->assertAssertionDataSet('modifyParentNChangeHotelChildrenSorting');
346 
347  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
348  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
349  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
350  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
351  }
352 
357  public function modifyParentWithHotelChild() {
358  parent::modifyParentWithHotelChild();
359  $this->assertAssertionDataSet('modifyParentNHotelChild');
360 
361  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
362  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
363  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
364  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
365  }
366 
371  public function modifyParentAndAddHotelChild() {
372  parent::modifyParentAndAddHotelChild();
373  $this->assertAssertionDataSet('modifyParentNAddHotelChild');
374 
375  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
376  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
377  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
378  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
379  }
380 
386  parent::modifyParentAndDeleteHotelChild();
387  $this->assertAssertionDataSet('modifyParentNDeleteHotelChild');
388 
389  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
390  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
391  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
392  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
393  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
394  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
395  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
396  }
397 
398 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=TRUE)