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