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/Regular/Modify/DataSet/';
26 
35  public function createContents()
36  {
37  parent::createContents();
38  $this->assertAssertionDataSet('createContents');
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', 'Testing #2'));
43  }
44 
49  public function modifyContent()
50  {
51  parent::modifyContent();
52  $this->assertAssertionDataSet('modifyContent');
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  }
58 
63  public function deleteContent()
64  {
65  parent::deleteContent();
66  $this->assertAssertionDataSet('deleteContent');
67 
68  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
69  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
70  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
71  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
72  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
73  }
74 
80  {
81  parent::deleteLocalizedContentAndDeleteContent();
82  $this->assertAssertionDataSet('deleteLocalizedContentNDeleteContent');
83 
84  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
85  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
86  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #3', '[Translate to Dansk:] Regular Element #3'));
87  }
88 
93  public function copyContent()
94  {
95  parent::copyContent();
96  $this->assertAssertionDataSet('copyContent');
97 
98  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
99  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
100  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
101  }
102 
107  public function copyContentToLanguage()
108  {
109  parent::copyContentToLanguage();
110  $this->assertAssertionDataSet('copyContentToLanguage');
111 
112  $this->setUpFrontendRootPage(1, [
113  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
114  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRendererNoOverlay.ts'
115  ]);
116  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
117  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
118  ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Regular Element #3', '[Translate to Dansk:] Regular Element #2'));
119  }
120 
126  {
127  parent::copyContentToLanguageFromNonDefaultLanguage();
128  $this->assertAssertionDataSet('copyContentToLanguageFromNonDefaultLanguage');
129 
130  $this->setUpFrontendRootPage(1, [
131  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
132  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRendererNoOverlay.ts'
133  ]);
134  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageIdSecond)->getResponseSections();
135  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
136  ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Deutsch:] [Translate to Dansk:] Regular Element #3'));
137  }
138 
143  public function copyPasteContent()
144  {
145  parent::copyPasteContent();
146  $this->assertAssertionDataSet('copyPasteContent');
147 
148  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
149  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
150  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
151  }
152 
157  public function localizeContent()
158  {
159  parent::localizeContent();
160  $this->assertAssertionDataSet('localizeContent');
161 
162  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
163  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
164  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
165  }
166 
172  {
173  parent::localizeContentFromNonDefaultLanguage();
174 
175  $this->assertAssertionDataSet('localizeContentFromNonDefaultLanguage');
176 
177  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageIdSecond)->getResponseSections();
178  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
179  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Deutsch:] [Translate to Dansk:] Regular Element #3'));
180  }
181 
186  public function changeContentSorting()
187  {
188  parent::changeContentSorting();
189  $this->assertAssertionDataSet('changeContentSorting');
190 
191  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
192  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
193  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
194  }
195 
200  public function moveContentToDifferentPage()
201  {
202  parent::moveContentToDifferentPage();
203  $this->assertAssertionDataSet('moveContentToDifferentPage');
204 
205  $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
206  $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
207  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
208  $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
209  $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
210  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
211  }
212 
218  {
219  parent::movePasteContentToDifferentPage();
220  $this->assertAssertionDataSet('movePasteContentToDifferentPage');
221 
222  $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
223  $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
224  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
225  $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
226  $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
227  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
228  }
229 
235  {
236  parent::moveContentToDifferentPageAndChangeSorting();
237  $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
238 
239  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
240  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
241  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
242  }
243 
252  public function createPage()
253  {
254  parent::createPage();
255  $this->assertAssertionDataSet('createPage');
256 
257  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
258  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
259  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
260  }
261 
266  public function modifyPage()
267  {
268  parent::modifyPage();
269  $this->assertAssertionDataSet('modifyPage');
270 
271  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
272  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
273  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
274  }
275 
280  public function deletePage()
281  {
282  parent::deletePage();
283  $this->assertAssertionDataSet('deletePage');
284 
285  $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, false);
286  $this->assertContains('PageNotFoundException', $response->getError());
287  }
288 
293  public function copyPage()
294  {
295  parent::copyPage();
296  $this->assertAssertionDataSet('copyPage');
297 
298  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
299  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
300  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
301  }
302 
307  public function copyPageFreeMode()
308  {
309  $this->importScenarioDataSet('LivePageFreeModeElements');
310  parent::copyPageFreeMode();
311  $this->assertAssertionDataSet('copyPageFreeMode');
312 
313  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
314  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
315  ->setTable(self::TABLE_Page)->setField('title')->setValues('Target'));
316  }
317 
322  public function localizePage()
323  {
324  parent::localizePage();
325  $this->assertAssertionDataSet('localizePage');
326 
327  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
328  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
329  ->setTable(self::TABLE_Page)->setField('title')->setValues('[Translate to Dansk:] Relations'));
330  }
331 
336  public function changePageSorting()
337  {
338  parent::changePageSorting();
339  $this->assertAssertionDataSet('changePageSorting');
340 
341  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
342  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
343  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
344  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
345  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
346  }
347 
352  public function movePageToDifferentPage()
353  {
354  parent::movePageToDifferentPage();
355  $this->assertAssertionDataSet('movePageToDifferentPage');
356 
357  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
358  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
359  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
360  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
361  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
362  }
363 
369  {
370  parent::movePageToDifferentPageAndChangeSorting();
371  $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
372 
373  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
374  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
375  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
376  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
377  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
378  }
379 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)
setUpFrontendRootPage($pageId, array $typoScriptFiles=[])