c5b4708d93e3115a99dc9484d21a7e1a661a56d6
[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/Assertion/changeContentRecordSorting.csv
134 */
135 public function changeContentSorting()
136 {
137 parent::changeContentSorting();
138 $this->assertAssertionDataSet('changeContentSorting');
139
140 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
141 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
142 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
143 }
144
145 /**
146 * @test
147 * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
148 */
149 public function moveContentToDifferentPage()
150 {
151 parent::moveContentToDifferentPage();
152 $this->assertAssertionDataSet('moveContentToDifferentPage');
153
154 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
155 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
156 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
157 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
158 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
159 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
160 }
161
162 /**
163 * @test
164 * @see DataSet/movePasteContentToDifferentPage.csv
165 */
166 public function movePasteContentToDifferentPage()
167 {
168 parent::movePasteContentToDifferentPage();
169 $this->assertAssertionDataSet('movePasteContentToDifferentPage');
170
171 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
172 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
173 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
174 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
175 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
176 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
177 }
178
179 /**
180 * @test
181 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
182 */
183 public function moveContentToDifferentPageAndChangeSorting()
184 {
185 parent::moveContentToDifferentPageAndChangeSorting();
186 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
187
188 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
189 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
190 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
191 }
192
193 /**
194 * Page records
195 */
196
197 /**
198 * @test
199 * @see DataSet/Assertion/createPageRecord.csv
200 */
201 public function createPage()
202 {
203 parent::createPage();
204 $this->assertAssertionDataSet('createPage');
205
206 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
207 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
208 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
209 }
210
211 /**
212 * @test
213 * @see DataSet/Assertion/modifyPageRecord.csv
214 */
215 public function modifyPage()
216 {
217 parent::modifyPage();
218 $this->assertAssertionDataSet('modifyPage');
219
220 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
221 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
222 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
223 }
224
225 /**
226 * @test
227 * @see DataSet/Assertion/deletePageRecord.csv
228 */
229 public function deletePage()
230 {
231 parent::deletePage();
232 $this->assertAssertionDataSet('deletePage');
233
234 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, false);
235 $this->assertContains('PageNotFoundException', $response->getError());
236 }
237
238 /**
239 * @test
240 * @see DataSet/Assertion/copyPageRecord.csv
241 */
242 public function copyPage()
243 {
244 parent::copyPage();
245 $this->assertAssertionDataSet('copyPage');
246
247 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
248 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
249 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
250 }
251
252 /**
253 * @test
254 * @see DataSet/Assertion/localizePageRecord.csv
255 */
256 public function localizePage()
257 {
258 parent::localizePage();
259 $this->assertAssertionDataSet('localizePage');
260
261 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
262 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
263 ->setTable(self::TABLE_Page)->setField('title')->setValues('[Translate to Dansk:] Relations'));
264 }
265
266 /**
267 * @test
268 * @see DataSet/Assertion/changePageRecordSorting.csv
269 */
270 public function changePageSorting()
271 {
272 parent::changePageSorting();
273 $this->assertAssertionDataSet('changePageSorting');
274
275 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
276 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
277 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
278 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
279 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
280 }
281
282 /**
283 * @test
284 * @see DataSet/Assertion/movePageRecordToDifferentPage.csv
285 */
286 public function movePageToDifferentPage()
287 {
288 parent::movePageToDifferentPage();
289 $this->assertAssertionDataSet('movePageToDifferentPage');
290
291 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->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
298 /**
299 * @test
300 * @see DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv
301 */
302 public function movePageToDifferentPageAndChangeSorting()
303 {
304 parent::movePageToDifferentPageAndChangeSorting();
305 $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
306
307 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
308 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
309 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
310 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
311 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
312 }
313 }