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