[BUGFIX] Allow array of paths in psr-4 autoload definition
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / ManyToMany / AbstractActionTestCase.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany;
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_ContentIdFirst = 297;
25 const VALUE_ContentIdLast = 298;
26 const VALUE_LanguageId = 1;
27 const VALUE_CategoryIdFirst = 28;
28 const VALUE_CategoryIdSecond = 29;
29 const VALUE_CategoryIdLast = 31;
30 const VALUE_WorkspaceId = 1;
31
32 const TABLE_Page = 'pages';
33 const TABLE_Content = 'tt_content';
34 const TABLE_Category = 'sys_category';
35 const TABLE_ContentCategory_ManyToMany = 'sys_category_record_mm';
36
37 /**
38 * @var string
39 */
40 protected $scenarioDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/';
41
42 /**
43 * @var array
44 */
45 protected $coreExtensionsToLoad = array(
46 'fluid',
47 'version',
48 'workspaces',
49 );
50
51 protected function setUp()
52 {
53 parent::setUp();
54 $this->importScenarioDataSet('LiveDefaultPages');
55 $this->importScenarioDataSet('LiveDefaultElements');
56 $this->importScenarioDataSet('ReferenceIndex');
57
58 $this->setUpFrontendRootPage(1, array('typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'));
59 $this->backendUser->workspace = self::VALUE_WorkspaceId;
60 }
61
62 /**
63 * MM Relations
64 */
65
66 /**
67 * @test
68 * @see DataSet/Assertion/addCategoryRelation.csv
69 */
70 public function addCategoryRelation()
71 {
72 $this->actionService->modifyReferences(
73 self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdLast)
74 );
75 }
76
77 /**
78 * @test
79 * @see DataSet/Assertion/deleteCategoryRelation.csv
80 */
81 public function deleteCategoryRelation()
82 {
83 $this->actionService->modifyReferences(
84 self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdFirst)
85 );
86 }
87
88 /**
89 * @test
90 * @see DataSet/Assertion/changeCategoryRelationSorting.csv
91 */
92 public function changeCategoryRelationSorting()
93 {
94 $this->actionService->modifyReferences(
95 self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdFirst)
96 );
97 }
98
99 /**
100 * @test
101 * @see DataSet/Assertion/createContentRecordAndAddCategoryRelation.csv
102 */
103 public function createContentAndAddRelation()
104 {
105 $newTableIds = $this->actionService->createNewRecord(
106 self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1', 'categories' => self::VALUE_CategoryIdSecond)
107 );
108 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
109 }
110
111 /**
112 * @test
113 * @see DataSet/Assertion/createCategoryRecordAndAddCategoryRelation.csv
114 */
115 public function createCategoryAndAddRelation()
116 {
117 $newTableIds = $this->actionService->createNewRecord(
118 self::TABLE_Category, 0, array('title' => 'Testing #1', 'items' => 'tt_content_' . self::VALUE_ContentIdFirst)
119 );
120 $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
121 }
122
123 /**
124 * @test
125 * @see DataSet/Assertion/createContentRecordAndCreateCategoryRelation.csv
126 */
127 public function createContentAndCreateRelation()
128 {
129 $newTableIds = $this->actionService->createNewRecords(
130 self::VALUE_PageId,
131 array(
132 self::TABLE_Category => array('pid' => 0, 'title' => 'Testing #1'),
133 self::TABLE_Content => array('header' => 'Testing #1', 'categories' => '__previousUid'),
134 )
135 );
136 $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
137 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
138 }
139
140 /**
141 * @test
142 * @see DataSet/Assertion/createCategoryRecordAndCreateCategoryRelation.csv
143 */
144 public function createCategoryAndCreateRelation()
145 {
146 $newTableIds = $this->actionService->createNewRecords(
147 self::VALUE_PageId,
148 array(
149 self::TABLE_Content => array('header' => 'Testing #1'),
150 self::TABLE_Category => array('pid' => 0, 'title' => 'Testing #1', 'items' => 'tt_content___previousUid'),
151 )
152 );
153 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
154 $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
155 }
156
157 /**
158 * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
159 */
160 public function modifyCategoryOfRelation()
161 {
162 $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, array('title' => 'Testing #1'));
163 }
164
165 /**
166 * @see DataSet/Assertion/modifyContentRecordOfCategoryRelation.csv
167 */
168 public function modifyContentOfRelation()
169 {
170 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
171 }
172
173 /**
174 * @see DataSet/Assertion/modifyBothRecordsOfCategoryRelation.csv
175 */
176 public function modifyBothsOfRelation()
177 {
178 $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, array('title' => 'Testing #1'));
179 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
180 }
181
182 /**
183 * @see DataSet/Assertion/deleteContentRecordOfCategoryRelation.csv
184 */
185 public function deleteContentOfRelation()
186 {
187 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
188 }
189
190 /**
191 * @see DataSet/Assertion/deleteCategoryRecordOfCategoryRelation.csv
192 */
193 public function deleteCategoryOfRelation()
194 {
195 $this->actionService->deleteRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst);
196 }
197
198 /**
199 * @see DataSet/Assertion/copyContentRecordOfCategoryRelation.csv
200 */
201 public function copyContentOfRelation()
202 {
203 $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
204 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
205 }
206
207 /**
208 * @see DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
209 */
210 public function copyCategoryOfRelation()
211 {
212 $newTableIds = $this->actionService->copyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, 0);
213 $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][self::VALUE_CategoryIdFirst];
214 }
215
216 /**
217 * @see DataSet/Assertion/localizeContentRecordOfCategoryRelation.csv
218 */
219 public function localizeContentOfRelation()
220 {
221 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
222 $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
223 }
224
225 /**
226 * @see DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
227 */
228 public function localizeCategoryOfRelation()
229 {
230 $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, self::VALUE_LanguageId);
231 $this->recordIds['localizedCategoryId'] = $localizedTableIds[self::TABLE_Category][self::VALUE_CategoryIdFirst];
232 }
233
234 /**
235 * @see DataSet/Assertion/moveContentRecordOfCategoryRelationToDifferentPage.csv
236 */
237 public function moveContentOfRelationToDifferentPage()
238 {
239 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
240 }
241
242 /**
243 * @see DataSet/Assertion/copyPage.csv
244 */
245 public function copyPage()
246 {
247 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
248 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
249 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
250 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
251 }
252 }