[TASK] Add functional test covering copying a page translated in free mode
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / Regular / Modify / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Core\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 /**
18 * Functional test for the DataHandler
19 */
20 class ActionTest extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\AbstractActionTestCase
21 {
22 /**
23 * @var string
24 */
25 protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/';
26
27 /**
28 * Content records
29 */
30
31 /**
32 * @test
33 * @see DataSet/Assertion/createContentRecords.csv
34 */
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
45 /**
46 * @test
47 * @see DataSet/Assertion/modifyContentRecord.csv
48 */
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
59 /**
60 * @test
61 * @see DataSet/Assertion/deleteContentRecord.csv
62 */
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
75 /**
76 * @test
77 * @see DataSet/deleteLocalizedContentNDeleteContent.csv
78 */
79 public function deleteLocalizedContentAndDeleteContent()
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
89 /**
90 * @test
91 * @see DataSet/Assertion/copyContentRecord.csv
92 */
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
103 /**
104 * @test
105 * @see DataSet/Assertion/copyContentRecord.csv
106 */
107 public function copyPasteContent()
108 {
109 parent::copyPasteContent();
110 $this->assertAssertionDataSet('copyPasteContent');
111
112 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
113 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
114 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
115 }
116
117 /**
118 * @test
119 * @see DataSet/Assertion/localizeContentRecord.csv
120 */
121 public function localizeContent()
122 {
123 parent::localizeContent();
124 $this->assertAssertionDataSet('localizeContent');
125
126 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
127 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
128 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
129 }
130
131 /**
132 * @test
133 * @see DataSet/localizeContentFromNonDefaultLanguage.csv
134 */
135 public function localizeContentFromNonDefaultLanguage()
136 {
137 parent::localizeContentFromNonDefaultLanguage();
138
139 $this->assertAssertionDataSet('localizeContentFromNonDefaultLanguage');
140
141 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageIdSecond)->getResponseSections();
142 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
143 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Deutsch:] [Translate to Dansk:] Regular Element #3'));
144 }
145
146 /**
147 * @test
148 * @see DataSet/Assertion/changeContentRecordSorting.csv
149 */
150 public function changeContentSorting()
151 {
152 parent::changeContentSorting();
153 $this->assertAssertionDataSet('changeContentSorting');
154
155 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
156 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
157 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
158 }
159
160 /**
161 * @test
162 * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
163 */
164 public function moveContentToDifferentPage()
165 {
166 parent::moveContentToDifferentPage();
167 $this->assertAssertionDataSet('moveContentToDifferentPage');
168
169 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
170 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
171 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
172 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
173 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
174 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
175 }
176
177 /**
178 * @test
179 * @see DataSet/movePasteContentToDifferentPage.csv
180 */
181 public function movePasteContentToDifferentPage()
182 {
183 parent::movePasteContentToDifferentPage();
184 $this->assertAssertionDataSet('movePasteContentToDifferentPage');
185
186 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
187 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
188 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
189 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
190 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
191 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
192 }
193
194 /**
195 * @test
196 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
197 */
198 public function moveContentToDifferentPageAndChangeSorting()
199 {
200 parent::moveContentToDifferentPageAndChangeSorting();
201 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
202
203 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
204 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
205 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
206 }
207
208 /**
209 * Page records
210 */
211
212 /**
213 * @test
214 * @see DataSet/Assertion/createPageRecord.csv
215 */
216 public function createPage()
217 {
218 parent::createPage();
219 $this->assertAssertionDataSet('createPage');
220
221 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
222 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
223 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
224 }
225
226 /**
227 * @test
228 * @see DataSet/Assertion/modifyPageRecord.csv
229 */
230 public function modifyPage()
231 {
232 parent::modifyPage();
233 $this->assertAssertionDataSet('modifyPage');
234
235 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
236 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
237 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
238 }
239
240 /**
241 * @test
242 * @see DataSet/Assertion/deletePageRecord.csv
243 */
244 public function deletePage()
245 {
246 parent::deletePage();
247 $this->assertAssertionDataSet('deletePage');
248
249 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, false);
250 $this->assertContains('PageNotFoundException', $response->getError());
251 }
252
253 /**
254 * @test
255 * @see DataSet/copyPage.csv
256 */
257 public function copyPage()
258 {
259 parent::copyPage();
260 $this->assertAssertionDataSet('copyPage');
261
262 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
263 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
264 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
265 }
266
267 /**
268 * @test
269 * @see DataSet/copyPageFreeMode.csv
270 */
271 public function copyPageFreeMode()
272 {
273 $this->importScenarioDataSet('LivePageFreeModeElements');
274 parent::copyPageFreeMode();
275 $this->assertAssertionDataSet('copyPageFreeMode');
276
277 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
278 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
279 ->setTable(self::TABLE_Page)->setField('title')->setValues('Target'));
280 }
281
282 /**
283 * @test
284 * @see DataSet/Assertion/localizePageRecord.csv
285 */
286 public function localizePage()
287 {
288 parent::localizePage();
289 $this->assertAssertionDataSet('localizePage');
290
291 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
292 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
293 ->setTable(self::TABLE_Page)->setField('title')->setValues('[Translate to Dansk:] Relations'));
294 }
295
296 /**
297 * @test
298 * @see DataSet/Assertion/changePageRecordSorting.csv
299 */
300 public function changePageSorting()
301 {
302 parent::changePageSorting();
303 $this->assertAssertionDataSet('changePageSorting');
304
305 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
306 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
307 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
308 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
309 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
310 }
311
312 /**
313 * @test
314 * @see DataSet/Assertion/movePageRecordToDifferentPage.csv
315 */
316 public function movePageToDifferentPage()
317 {
318 parent::movePageToDifferentPage();
319 $this->assertAssertionDataSet('movePageToDifferentPage');
320
321 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
322 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
323 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
324 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
325 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
326 }
327
328 /**
329 * @test
330 * @see DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv
331 */
332 public function movePageToDifferentPageAndChangeSorting()
333 {
334 parent::movePageToDifferentPageAndChangeSorting();
335 $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
336
337 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
338 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
339 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
340 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
341 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
342 }
343 }