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