[CLEANUP] Remove obsolete require_once from test files
[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 parent::createContents();
37 $this->assertAssertionDataSet('createContents');
38
39 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
40 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
41 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', 'Testing #2'));
42 }
43
44 /**
45 * @test
46 * @see DataSet/Assertion/modifyContentRecord.csv
47 */
48 public function modifyContent() {
49 parent::modifyContent();
50 $this->assertAssertionDataSet('modifyContent');
51
52 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
53 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
54 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
55 }
56
57 /**
58 * @test
59 * @see DataSet/Assertion/deleteContentRecord.csv
60 */
61 public function deleteContent() {
62 parent::deleteContent();
63 $this->assertAssertionDataSet('deleteContent');
64
65 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
66 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
67 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
68 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
69 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
70 }
71
72 /**
73 * @test
74 * @see DataSet/deleteLocalizedContentNDeleteContent.csv
75 */
76 public function deleteLocalizedContentAndDeleteContent() {
77 parent::deleteLocalizedContentAndDeleteContent();
78 $this->assertAssertionDataSet('deleteLocalizedContentNDeleteContent');
79
80 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
81 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
82 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #3', '[Translate to Dansk:] Regular Element #3'));
83 }
84
85 /**
86 * @test
87 * @see DataSet/Assertion/copyContentRecord.csv
88 */
89 public function copyContent() {
90 parent::copyContent();
91 $this->assertAssertionDataSet('copyContent');
92
93 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
94 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
95 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
96 }
97
98 /**
99 * @test
100 * @see DataSet/Assertion/copyContentRecord.csv
101 */
102 public function copyPasteContent() {
103 parent::copyPasteContent();
104 $this->assertAssertionDataSet('copyPasteContent');
105
106 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
107 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
108 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
109 }
110
111 /**
112 * @test
113 * @see DataSet/Assertion/localizeContentRecord.csv
114 */
115 public function localizeContent() {
116 parent::localizeContent();
117 $this->assertAssertionDataSet('localizeContent');
118
119 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
120 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
121 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
122 }
123
124 /**
125 * @test
126 * @see DataSet/Assertion/changeContentRecordSorting.csv
127 */
128 public function changeContentSorting() {
129 parent::changeContentSorting();
130 $this->assertAssertionDataSet('changeContentSorting');
131
132 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
133 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
134 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
135 }
136
137 /**
138 * @test
139 * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
140 */
141 public function moveContentToDifferentPage() {
142 parent::moveContentToDifferentPage();
143 $this->assertAssertionDataSet('moveContentToDifferentPage');
144
145 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
146 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
147 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
148 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
149 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
150 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
151 }
152
153 /**
154 * @test
155 * @see DataSet/movePasteContentToDifferentPage.csv
156 */
157 public function movePasteContentToDifferentPage() {
158 parent::movePasteContentToDifferentPage();
159 $this->assertAssertionDataSet('movePasteContentToDifferentPage');
160
161 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
162 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
163 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
164 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
165 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
166 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
167 }
168
169 /**
170 * @test
171 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
172 */
173 public function moveContentToDifferentPageAndChangeSorting() {
174 parent::moveContentToDifferentPageAndChangeSorting();
175 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
176
177 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
178 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
179 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
180 }
181
182 /**
183 * Page records
184 */
185
186 /**
187 * @test
188 * @see DataSet/Assertion/createPageRecord.csv
189 */
190 public function createPage() {
191 parent::createPage();
192 $this->assertAssertionDataSet('createPage');
193
194 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
195 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
196 ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
197 }
198
199 /**
200 * @test
201 * @see DataSet/Assertion/modifyPageRecord.csv
202 */
203 public function modifyPage() {
204 parent::modifyPage();
205 $this->assertAssertionDataSet('modifyPage');
206
207 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->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->assertAssertionDataSet('deletePage');
219
220 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, FALSE);
221 $this->assertContains('PageNotFoundException', $response->getError());
222 }
223
224 /**
225 * @test
226 * @see DataSet/Assertion/copyPageRecord.csv
227 */
228 public function copyPage() {
229 parent::copyPage();
230 $this->assertAssertionDataSet('copyPage');
231
232 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
233 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
234 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
235 }
236
237 /**
238 * @test
239 * @see DataSet/Assertion/localizePageRecord.csv
240 */
241 public function localizePage() {
242 parent::localizePage();
243 $this->assertAssertionDataSet('localizePage');
244
245 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
246 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
247 ->setTable(self::TABLE_Page)->setField('title')->setValues('[Translate to Dansk:] Relations'));
248 }
249
250 /**
251 * @test
252 * @see DataSet/Assertion/changePageRecordSorting.csv
253 */
254 public function changePageSorting() {
255 parent::changePageSorting();
256 $this->assertAssertionDataSet('changePageSorting');
257
258 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
259 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
260 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
261 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
262 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
263 }
264
265 /**
266 * @test
267 * @see DataSet/Assertion/movePageRecordToDifferentPage.csv
268 */
269 public function movePageToDifferentPage() {
270 parent::movePageToDifferentPage();
271 $this->assertAssertionDataSet('movePageToDifferentPage');
272
273 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
274 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
275 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
276 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
277 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
278 }
279
280 /**
281 * @test
282 * @see DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv
283 */
284 public function movePageToDifferentPageAndChangeSorting() {
285 parent::movePageToDifferentPageAndChangeSorting();
286 $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
287
288 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
289 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
290 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
291 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
292 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
293 }
294
295 }