[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / Regular / PublishAll / ActionTest.php
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
17 require_once dirname(dirname(__FILE__)) . '/AbstractActionTestCase.php';
18
19 /**
20 * Functional test for the DataHandler
21 */
22 class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Regular\AbstractActionTestCase {
23
24 /**
25 * @var string
26 */
27 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/';
28
29 /**
30 * Content records
31 */
32
33 /**
34 * @test
35 * @see DataSet/Assertion/createContentRecords.csv
36 */
37 public function createContents() {
38 parent::createContents();
39 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
40 $this->assertAssertionDataSet('createContents');
41
42 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
43 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
44 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', 'Testing #2'));
45 }
46
47 /**
48 * @test
49 * @see DataSet/Assertion/createContentRecordAndDiscardCreatedContentRecord.csv
50 */
51 public function createContentAndDiscardCreatedContent() {
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
61 /**
62 * @test
63 * @see DataSet/Assertion/createAndCopyContentRecordAndDiscardCopiedContentRecord.csv
64 */
65 public function createAndCopyContentAndDiscardCopiedContent() {
66 parent::createAndCopyContentAndDiscardCopiedContent();
67 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
68 $this->assertAssertionDataSet('createNCopyContentNDiscardCopiedContent');
69
70 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
71 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
72 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
73 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
74 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1 (copy 1)'));
75 }
76
77 /**
78 * @test
79 * @see DataSet/Assertion/modifyContentRecord.csv
80 */
81 public function modifyContent() {
82 parent::modifyContent();
83 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
84 $this->assertAssertionDataSet('modifyContent');
85
86 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
87 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
88 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
89 }
90
91 /**
92 * @test
93 * @see DataSet/Assertion/deleteContentRecord.csv
94 */
95 public function deleteContent() {
96 parent::deleteContent();
97 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
98 $this->assertAssertionDataSet('deleteContent');
99
100 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
101 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
102 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
103 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
104 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
105 }
106
107 /**
108 * @test
109 * @see DataSet/Assertion/copyContentRecord.csv
110 */
111 public function copyContent() {
112 parent::copyContent();
113 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
114 $this->assertAssertionDataSet('copyContent');
115
116 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
117 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
118 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
119 }
120
121 /**
122 * @test
123 * @see DataSet/Assertion/localizeContentRecord.csv
124 */
125 public function localizeContent() {
126 parent::localizeContent();
127 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
128 $this->assertAssertionDataSet('localizeContent');
129
130 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
131 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
132 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
133 }
134
135 /**
136 * @test
137 * @see DataSet/Assertion/changeContentRecordSorting.csv
138 */
139 public function changeContentSorting() {
140 parent::changeContentSorting();
141 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
142 $this->assertAssertionDataSet('changeContentSorting');
143
144 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
145 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
146 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
147 }
148
149 /**
150 * @test
151 * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
152 */
153 public function moveContentToDifferentPage() {
154 parent::moveContentToDifferentPage();
155 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
156 $this->assertAssertionDataSet('moveContentToDifferentPage');
157
158 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
159 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
160 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
161 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
162 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
163 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
164 }
165
166 /**
167 * @test
168 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
169 */
170 public function moveContentToDifferentPageAndChangeSorting() {
171 parent::moveContentToDifferentPageAndChangeSorting();
172 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
173 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
174
175 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
176 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
177 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
178 }
179
180 /**
181 * Page records
182 */
183
184 /**
185 * @test
186 * @see DataSet/Assertion/createPageRecord.csv
187 */
188 public function createPage() {
189 parent::createPage();
190 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
191 $this->assertAssertionDataSet('createPage');
192
193 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
194 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
195 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
196 }
197
198 /**
199 * @test
200 * @see DataSet/Assertion/modifyPageRecord.csv
201 */
202 public function modifyPage() {
203 parent::modifyPage();
204 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
205 $this->assertAssertionDataSet('modifyPage');
206
207 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
208 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
209 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
210 }
211
212 /**
213 * @test
214 * @see DataSet/Assertion/deletePageRecord.csv
215 */
216 public function deletePage() {
217 parent::deletePage();
218 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
219 $this->assertAssertionDataSet('deletePage');
220
221 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, FALSE);
222 $this->assertContains('PageNotFoundException', $response->getError());
223 }
224
225 /**
226 * @test
227 * @see DataSet/Assertion/copyPageRecord.csv
228 */
229 public function copyPage() {
230 parent::copyPage();
231 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
232 $this->assertAssertionDataSet('copyPage');
233
234 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0)->getResponseSections();
235 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
236 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
237 }
238
239 /**
240 * @test
241 * @see DataSet/Assertion/localizePageRecord.csv
242 */
243 public function localizePage() {
244 parent::localizePage();
245 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
246 $this->assertAssertionDataSet('localizePage');
247
248 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
249 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
250 ->setTable(self::TABLE_Page)->setField('title')->setValues('[Translate to Dansk:] Relations'));
251 }
252
253 /**
254 * @test
255 * @see DataSet/Assertion/changePageRecordSorting.csv
256 */
257 public function changePageSorting() {
258 parent::changePageSorting();
259 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
260 $this->assertAssertionDataSet('changePageSorting');
261
262 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
263 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
264 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
265 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
266 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
267 }
268
269 /**
270 * @test
271 * @see DataSet/Assertion/movePageRecordToDifferentPage.csv
272 */
273 public function movePageToDifferentPage() {
274 parent::movePageToDifferentPage();
275 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
276 $this->assertAssertionDataSet('movePageToDifferentPage');
277
278 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
279 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
280 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
281 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
282 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
283 }
284
285 /**
286 * @test
287 * @see DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv
288 */
289 public function movePageToDifferentPageAndChangeSorting() {
290 parent::movePageToDifferentPageAndChangeSorting();
291 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
292 $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
293
294 $responseSectionsPage = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
295 $this->assertThat($responseSectionsPage, $this->getRequestSectionHasRecordConstraint()
296 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
297 $this->assertThat($responseSectionsPage, $this->getRequestSectionHasRecordConstraint()
298 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
299 $responseSectionsWebsite = $this->getFrontendResponse(self::VALUE_PageIdWebsite, 0)->getResponseSections();
300 $this->assertThat($responseSectionsWebsite, $this->getRequestSectionStructureHasRecordConstraint()
301 ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageIdWebsite)->setRecordField('__pages')
302 ->setTable(self::TABLE_Page)->setField('title')->setValues('Target', 'Relations', 'DataHandlerTest'));
303 }
304
305 /**
306 * @test
307 * @see DataSet/Assertion/movePageRecordToDifferentPageAndCreatePageRecordAfterMovedPageRecord.csv
308 * @see http://forge.typo3.org/issues/33104
309 * @see http://forge.typo3.org/issues/55573
310 */
311 public function movePageToDifferentPageAndCreatePageAfterMovedPage() {
312 parent::movePageToDifferentPageAndCreatePageAfterMovedPage();
313 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
314 $this->assertAssertionDataSet('movePageToDifferentPageNCreatePageAfterMovedPage');
315
316 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdWebsite, 0)->getResponseSections();
317 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
318 ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageIdWebsite)->setRecordField('__pages')
319 ->setTable(self::TABLE_Page)->setField('title')->setValues('Target', 'Testing #1', 'DataHandlerTest'));
320 }
321
322 }