[BUGFIX] Make checks in localize compatible with new Localization Wizard
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / Regular / AbstractActionTestCase.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular;
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 abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
21 {
22 const VALUE_PageId = 89;
23 const VALUE_PageIdTarget = 90;
24 const VALUE_PageIdWebsite = 1;
25 const VALUE_ContentIdFirst = 297;
26 const VALUE_ContentIdSecond = 298;
27 const VALUE_ContentIdThird = 299;
28 const VALUE_ContentIdThirdLocalized = 300;
29 const VALUE_LanguageId = 1;
30 const VALUE_LanguageIdSecond = 2;
31
32 const TABLE_Page = 'pages';
33 const TABLE_Content = 'tt_content';
34
35 /**
36 * @var string
37 */
38 protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Regular/DataSet/';
39
40 protected function setUp()
41 {
42 parent::setUp();
43 $this->importScenarioDataSet('LiveDefaultPages');
44 $this->importScenarioDataSet('LiveDefaultElements');
45
46 $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts']);
47 $this->backendUser->workspace = 0;
48 }
49
50 /**
51 * Content records
52 */
53
54 /**
55 * @test
56 * @see DataSet/Assertion/createContentRecords.csv
57 */
58 public function createContents()
59 {
60 // Creating record at the beginning of the page
61 $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
62 // Creating record at the end of the page (after last one)
63 $this->actionService->createNewRecord(self::TABLE_Content, -self::VALUE_ContentIdSecond, ['header' => 'Testing #2']);
64 }
65
66 /**
67 * @test
68 * @see DataSet/Assertion/modifyContentRecord.csv
69 */
70 public function modifyContent()
71 {
72 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, ['header' => 'Testing #1']);
73 }
74
75 /**
76 * @test
77 * @see DataSet/Assertion/deleteContentRecord.csv
78 */
79 public function deleteContent()
80 {
81 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
82 }
83
84 /**
85 * @see DataSet/deleteLocalizedContentNDeleteContent.csv
86 */
87 public function deleteLocalizedContentAndDeleteContent()
88 {
89 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdThirdLocalized);
90 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdThird);
91 }
92
93 /**
94 * @test
95 * @see DataSet/Assertion/copyContentRecord.csv
96 */
97 public function copyContent()
98 {
99 $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageId);
100 }
101
102 /**
103 * @test
104 * @see DataSet/copyPasteContent.csv
105 */
106 public function copyPasteContent()
107 {
108 $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageId, ['header' => 'Testing #1']);
109 }
110
111 /**
112 * @test
113 * @see DataSet/Assertion/localizeContentRecord.csv
114 */
115 public function localizeContent()
116 {
117 $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
118 }
119
120 /**
121 * @test
122 * @see DataSet/Assertion/localizeContentFromNonDefaultLanguage.csv
123 */
124 public function localizeContentFromNonDefaultLanguage()
125 {
126 $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdThirdLocalized, self::VALUE_LanguageIdSecond);
127 }
128
129 /**
130 * @test
131 * @see DataSet/Assertion/changeContentRecordSorting.csv
132 */
133 public function changeContentSorting()
134 {
135 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
136 }
137
138 /**
139 * @test
140 * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
141 */
142 public function moveContentToDifferentPage()
143 {
144 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget);
145 }
146
147 /**
148 * @test
149 * @see DataSet/movePasteContentToDifferentPage.csv
150 */
151 public function movePasteContentToDifferentPage()
152 {
153 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget, ['header' => 'Testing #1']);
154 }
155
156 /**
157 * @test
158 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
159 */
160 public function moveContentToDifferentPageAndChangeSorting()
161 {
162 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget);
163 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
164 }
165
166 /**
167 * Page records
168 */
169
170 /**
171 * @test
172 * @see DataSet/Assertion/createPageRecord.csv
173 */
174 public function createPage()
175 {
176 $newTableIds = $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1', 'hidden' => 0]);
177 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][0];
178 }
179
180 /**
181 * @test
182 * @see DataSet/Assertion/modifyPageRecord.csv
183 */
184 public function modifyPage()
185 {
186 $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1']);
187 }
188
189 /**
190 * @test
191 * @see DataSet/Assertion/deletePageRecord.csv
192 */
193 public function deletePage()
194 {
195 $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
196 }
197
198 /**
199 * @test
200 * @see DataSet/Assertion/copyPageRecord.csv
201 */
202 public function copyPage()
203 {
204 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
205 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
206 }
207
208 /**
209 * @test
210 * @see DataSet/Assertion/localizePageRecord.csv
211 */
212 public function localizePage()
213 {
214 $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
215 }
216
217 /**
218 * @test
219 * @see DataSet/Assertion/changePageRecordSorting.csv
220 */
221 public function changePageSorting()
222 {
223 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
224 }
225
226 /**
227 * @test
228 * @see DataSet/Assertion/movePageRecordToDifferentPage.csv
229 */
230 public function movePageToDifferentPage()
231 {
232 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
233 }
234
235 /**
236 * @test
237 * @see DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv
238 */
239 public function movePageToDifferentPageAndChangeSorting()
240 {
241 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageIdTarget, self::VALUE_PageIdWebsite);
242 $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
243 }
244 }