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