520c6cb75dac3709837010034d1bae4cf79c5c88
[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 * Copyright notice
6 *
7 * (c) 2014 Oliver Hader <oliver.hader@typo3.org>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 require_once dirname(dirname(__FILE__)) . '/AbstractActionTestCase.php';
28
29 /**
30 * Functional test for the DataHandler
31 */
32 class ActionTest extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\AbstractActionTestCase {
33
34 /**
35 * @var string
36 */
37 protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/';
38
39 /**
40 * Content records
41 */
42
43 /**
44 * @test
45 * @see DataSet/Assertion/createContentRecords.csv
46 */
47 public function createContents() {
48 parent::createContents();
49 $this->assertAssertionDataSet('createContents');
50
51 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
52 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Testing #1', 'Testing #2'));
53 }
54
55 /**
56 * @test
57 * @see DataSet/Assertion/modifyContentRecord.csv
58 */
59 public function modifyContent() {
60 parent::modifyContent();
61 $this->assertAssertionDataSet('modifyContent');
62
63 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
64 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', 'Testing #1');
65 }
66
67 /**
68 * @test
69 * @see DataSet/Assertion/deleteContentRecord.csv
70 */
71 public function deleteContent() {
72 parent::deleteContent();
73 $this->assertAssertionDataSet('deleteContent');
74
75 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
76 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', 'Regular Element #1');
77 $this->assertResponseContentDoesNotHaveRecords($responseContent, self::TABLE_Content, 'header', 'Regular Element #2');
78 }
79
80 /**
81 * @test
82 * @see DataSet/Assertion/copyContentRecord.csv
83 */
84 public function copyContent() {
85 parent::copyContent();
86 $this->assertAssertionDataSet('copyContent');
87
88 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
89 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', 'Regular Element #2 (copy 1)');
90 }
91
92 /**
93 * @test
94 * @see DataSet/Assertion/copyContentRecord.csv
95 */
96 public function copyPasteContent() {
97 parent::copyPasteContent();
98 $this->assertAssertionDataSet('copyPasteContent');
99
100 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
101 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', 'Testing #1');
102 }
103
104 /**
105 * @test
106 * @see DataSet/Assertion/localizeContentRecord.csv
107 */
108 public function localizeContent() {
109 parent::localizeContent();
110 $this->assertAssertionDataSet('localizeContent');
111
112 $responseContent = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseContent();
113 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
114 }
115
116 /**
117 * @test
118 * @see DataSet/Assertion/changeContentRecordSorting.csv
119 */
120 public function changeContentSorting() {
121 parent::changeContentSorting();
122 $this->assertAssertionDataSet('changeContentSorting');
123
124 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
125 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
126 }
127
128 /**
129 * @test
130 * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
131 */
132 public function moveContentToDifferentPage() {
133 parent::moveContentToDifferentPage();
134 $this->assertAssertionDataSet('moveContentToDifferentPage');
135
136 $responseContentSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
137 $this->assertResponseContentHasRecords($responseContentSource, self::TABLE_Content, 'header', 'Regular Element #1');
138 $responseContentTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseContent();
139 $this->assertResponseContentHasRecords($responseContentTarget, self::TABLE_Content, 'header', 'Regular Element #2');
140 }
141
142 /**
143 * @test
144 * @see DataSet/movePasteContentToDifferentPage.csv
145 */
146 public function movePasteContentToDifferentPage() {
147 parent::movePasteContentToDifferentPage();
148 $this->assertAssertionDataSet('movePasteContentToDifferentPage');
149
150 $responseContentSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
151 $this->assertResponseContentHasRecords($responseContentSource, self::TABLE_Content, 'header', 'Regular Element #1');
152 $responseContentTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseContent();
153 $this->assertResponseContentHasRecords($responseContentTarget, self::TABLE_Content, 'header', 'Testing #1');
154 }
155
156 /**
157 * @test
158 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
159 */
160 public function moveContentToDifferentPageAndChangeSorting() {
161 parent::moveContentToDifferentPageAndChangeSorting();
162 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
163
164 $responseContent = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseContent();
165 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
166 }
167
168 /**
169 * Page records
170 */
171
172 /**
173 * @test
174 * @see DataSet/Assertion/createPageRecord.csv
175 */
176 public function createPage() {
177 parent::createPage();
178 $this->assertAssertionDataSet('createPage');
179
180 $responseContent = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseContent();
181 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Testing #1');
182 }
183
184 /**
185 * @test
186 * @see DataSet/Assertion/modifyPageRecord.csv
187 */
188 public function modifyPage() {
189 parent::modifyPage();
190 $this->assertAssertionDataSet('modifyPage');
191
192 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
193 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Testing #1');
194 }
195
196 /**
197 * @test
198 * @see DataSet/Assertion/deletePageRecord.csv
199 */
200 public function deletePage() {
201 parent::deletePage();
202 $this->assertAssertionDataSet('deletePage');
203
204 $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, FALSE);
205 $this->assertContains('PageNotFoundException', $response->getError());
206 }
207
208 /**
209 * @test
210 * @see DataSet/Assertion/copyPageRecord.csv
211 */
212 public function copyPage() {
213 parent::copyPage();
214 $this->assertAssertionDataSet('copyPage');
215
216 $responseContent = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseContent();
217 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
218 }
219
220 /**
221 * @test
222 * @see DataSet/Assertion/localizePageRecord.csv
223 */
224 public function localizePage() {
225 parent::localizePage();
226 $this->assertAssertionDataSet('localizePage');
227
228 $responseContent = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseContent();
229 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', '[Translate to Dansk:] Relations');
230 }
231
232 /**
233 * @test
234 * @see DataSet/Assertion/changePageRecordSorting.csv
235 */
236 public function changePageSorting() {
237 parent::changePageSorting();
238 $this->assertAssertionDataSet('changePageSorting');
239
240 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
241 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
242 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
243 }
244
245 /**
246 * @test
247 * @see DataSet/Assertion/movePageRecordToDifferentPage.csv
248 */
249 public function movePageToDifferentPage() {
250 parent::movePageToDifferentPage();
251 $this->assertAssertionDataSet('movePageToDifferentPage');
252
253 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
254 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
255 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
256 }
257
258 /**
259 * @test
260 * @see DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv
261 */
262 public function movePageToDifferentPageAndChangeSorting() {
263 parent::movePageToDifferentPageAndChangeSorting();
264 $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
265
266 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
267 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
268 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
269 }
270
271 }