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