TYPO3  7.6
Regular/PublishAll/ActionTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Regular\PublishAll;
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/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/';
26 
35  public function createContents()
36  {
37  parent::createContents();
38  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
39  $this->assertAssertionDataSet('createContents');
40 
41  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
42  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
43  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', 'Testing #2'));
44  }
45 
51  {
52  parent::createContentAndDiscardCreatedContent();
53  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
54  $this->assertAssertionDataSet('createContentNDiscardCreatedContent');
55 
56  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
57  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
58  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
59  }
60 
66  {
67  parent::createAndCopyContentAndDiscardCopiedContent();
68  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
69  $this->assertAssertionDataSet('createNCopyContentNDiscardCopiedContent');
70 
71  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
72  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
73  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
74  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
75  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
76  }
77 
82  public function modifyContent()
83  {
84  parent::modifyContent();
85  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
86  $this->assertAssertionDataSet('modifyContent');
87 
88  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
89  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
90  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
91  }
92 
97  public function deleteContent()
98  {
99  parent::deleteContent();
100  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
101  $this->assertAssertionDataSet('deleteContent');
102 
103  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
104  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
105  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
106  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
107  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
108  }
109 
115  {
116  parent::deleteLocalizedContentAndDeleteContent();
117  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
118  $this->assertAssertionDataSet('deleteLocalizedContentNDeleteContent');
119 
120  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
121  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
122  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #3', '[Translate to Dansk:] Regular Element #3'));
123  }
124 
129  public function copyContent()
130  {
131  parent::copyContent();
132  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
133  $this->assertAssertionDataSet('copyContent');
134 
135  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
136  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
137  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
138  }
139 
144  public function localizeContent()
145  {
146  parent::localizeContent();
147  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
148  $this->assertAssertionDataSet('localizeContent');
149 
150  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
151  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
152  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
153  }
154 
159  public function changeContentSorting()
160  {
161  parent::changeContentSorting();
162  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
163  $this->assertAssertionDataSet('changeContentSorting');
164 
165  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
166  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
167  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
168  }
169 
174  public function moveContentToDifferentPage()
175  {
176  parent::moveContentToDifferentPage();
177  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
178  $this->assertAssertionDataSet('moveContentToDifferentPage');
179 
180  $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
181  $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
182  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
183  $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
184  $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
185  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
186  }
187 
193  {
194  parent::moveContentToDifferentPageAndChangeSorting();
195  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
196  $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
197 
198  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
199  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
200  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
201  }
202 
211  public function createPage()
212  {
213  parent::createPage();
214  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
215  $this->assertAssertionDataSet('createPage');
216 
217  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
218  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
219  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
220  }
221 
226  public function modifyPage()
227  {
228  parent::modifyPage();
229  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
230  $this->assertAssertionDataSet('modifyPage');
231 
232  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
233  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
234  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
235  }
236 
241  public function deletePage()
242  {
243  parent::deletePage();
244  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
245  $this->assertAssertionDataSet('deletePage');
246 
247  $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, false);
248  $this->assertContains('PageNotFoundException', $response->getError());
249  }
250 
255  public function copyPage()
256  {
257  parent::copyPage();
258  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
259  $this->assertAssertionDataSet('copyPage');
260 
261  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
262  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
263  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
264  }
265 
270  public function localizePage()
271  {
272  parent::localizePage();
273  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
274  $this->assertAssertionDataSet('localizePage');
275 
276  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
277  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
278  ->setTable(self::TABLE_Page)->setField('title')->setValues('[Translate to Dansk:] Relations'));
279  }
280 
285  public function changePageSorting()
286  {
287  parent::changePageSorting();
288  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
289  $this->assertAssertionDataSet('changePageSorting');
290 
291  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
292  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
293  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
294  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
295  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
296  }
297 
302  public function movePageToDifferentPage()
303  {
304  parent::movePageToDifferentPage();
305  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
306  $this->assertAssertionDataSet('movePageToDifferentPage');
307 
308  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
309  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
310  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
311  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
312  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
313  }
314 
320  {
321  parent::movePageToDifferentPageAndChangeSorting();
322  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
323  $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
324 
325  $responseSectionsPage = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
326  $this->assertThat($responseSectionsPage, $this->getRequestSectionHasRecordConstraint()
327  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
328  $this->assertThat($responseSectionsPage, $this->getRequestSectionHasRecordConstraint()
329  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
330  $responseSectionsWebsite = $this->getFrontendResponse(self::VALUE_PageIdWebsite, 0)->getResponseSections();
331  $this->assertThat($responseSectionsWebsite, $this->getRequestSectionStructureHasRecordConstraint()
332  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageIdWebsite)->setRecordField('__pages')
333  ->setTable(self::TABLE_Page)->setField('title')->setValues('Target', 'Relations', 'DataHandlerTest'));
334  }
335 
343  {
344  parent::movePageToDifferentPageAndCreatePageAfterMovedPage();
345  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
346  $this->assertAssertionDataSet('movePageToDifferentPageNCreatePageAfterMovedPage');
347 
348  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdWebsite, 0)->getResponseSections();
349  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
350  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageIdWebsite)->setRecordField('__pages')
351  ->setTable(self::TABLE_Page)->setField('title')->setValues('Target', 'Testing #1', 'DataHandlerTest'));
352  }
353 }