2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany
;
5 * This file is part of the TYPO3 CMS project.
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.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
18 * Functional test for the DataHandler
20 abstract class AbstractActionTestCase
extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
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;
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';
40 protected $scenarioDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/';
45 protected $coreExtensionsToLoad = array(
51 protected function setUp()
54 $this->importScenarioDataSet('LiveDefaultPages');
55 $this->importScenarioDataSet('LiveDefaultElements');
56 $this->importScenarioDataSet('ReferenceIndex');
58 $this->setUpFrontendRootPage(1, array('typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'));
59 $this->backendUser
->workspace
= self
::VALUE_WorkspaceId
;
68 * @see DataSet/Assertion/addCategoryRelation.csv
70 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
)
79 * @see DataSet/Assertion/deleteCategoryRelation.csv
81 public function deleteCategoryRelation()
83 $this->actionService
->modifyReferences(
84 self
::TABLE_Content
, self
::VALUE_ContentIdFirst
, 'categories', array(self
::VALUE_CategoryIdFirst
)
90 * @see DataSet/Assertion/changeCategoryRelationSorting.csv
92 public function changeCategoryRelationSorting()
94 $this->actionService
->modifyReferences(
95 self
::TABLE_Content
, self
::VALUE_ContentIdFirst
, 'categories', array(self
::VALUE_CategoryIdSecond
, self
::VALUE_CategoryIdFirst
)
101 * @see DataSet/Assertion/createContentRecordAndAddCategoryRelation.csv
103 public function createContentAndAddRelation()
105 $newTableIds = $this->actionService
->createNewRecord(
106 self
::TABLE_Content
, self
::VALUE_PageId
, array('header' => 'Testing #1', 'categories' => self
::VALUE_CategoryIdSecond
)
108 $this->recordIds
['newContentId'] = $newTableIds[self
::TABLE_Content
][0];
113 * @see DataSet/Assertion/createCategoryRecordAndAddCategoryRelation.csv
115 public function createCategoryAndAddRelation()
117 $newTableIds = $this->actionService
->createNewRecord(
118 self
::TABLE_Category
, 0, array('title' => 'Testing #1', 'items' => 'tt_content_' . self
::VALUE_ContentIdFirst
)
120 $this->recordIds
['newCategoryId'] = $newTableIds[self
::TABLE_Category
][0];
125 * @see DataSet/Assertion/createContentRecordAndCreateCategoryRelation.csv
127 public function createContentAndCreateRelation()
129 $newTableIds = $this->actionService
->createNewRecords(
132 self
::TABLE_Category
=> array('pid' => 0, 'title' => 'Testing #1'),
133 self
::TABLE_Content
=> array('header' => 'Testing #1', 'categories' => '__previousUid'),
136 $this->recordIds
['newCategoryId'] = $newTableIds[self
::TABLE_Category
][0];
137 $this->recordIds
['newContentId'] = $newTableIds[self
::TABLE_Content
][0];
142 * @see DataSet/Assertion/createCategoryRecordAndCreateCategoryRelation.csv
144 public function createCategoryAndCreateRelation()
146 $newTableIds = $this->actionService
->createNewRecords(
149 self
::TABLE_Content
=> array('header' => 'Testing #1'),
150 self
::TABLE_Category
=> array('pid' => 0, 'title' => 'Testing #1', 'items' => 'tt_content___previousUid'),
153 $this->recordIds
['newContentId'] = $newTableIds[self
::TABLE_Content
][0];
154 $this->recordIds
['newCategoryId'] = $newTableIds[self
::TABLE_Category
][0];
158 * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
160 public function modifyCategoryOfRelation()
162 $this->actionService
->modifyRecord(self
::TABLE_Category
, self
::VALUE_CategoryIdFirst
, array('title' => 'Testing #1'));
166 * @see DataSet/Assertion/modifyContentRecordOfCategoryRelation.csv
168 public function modifyContentOfRelation()
170 $this->actionService
->modifyRecord(self
::TABLE_Content
, self
::VALUE_ContentIdFirst
, array('header' => 'Testing #1'));
174 * @see DataSet/Assertion/modifyBothRecordsOfCategoryRelation.csv
176 public function modifyBothsOfRelation()
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'));
183 * @see DataSet/Assertion/deleteContentRecordOfCategoryRelation.csv
185 public function deleteContentOfRelation()
187 $this->actionService
->deleteRecord(self
::TABLE_Content
, self
::VALUE_ContentIdLast
);
191 * @see DataSet/Assertion/deleteCategoryRecordOfCategoryRelation.csv
193 public function deleteCategoryOfRelation()
195 $this->actionService
->deleteRecord(self
::TABLE_Category
, self
::VALUE_CategoryIdFirst
);
199 * @see DataSet/Assertion/copyContentRecordOfCategoryRelation.csv
201 public function copyContentOfRelation()
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
];
208 * @see DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
210 public function copyCategoryOfRelation()
212 $newTableIds = $this->actionService
->copyRecord(self
::TABLE_Category
, self
::VALUE_CategoryIdFirst
, 0);
213 $this->recordIds
['newCategoryId'] = $newTableIds[self
::TABLE_Category
][self
::VALUE_CategoryIdFirst
];
217 * @see DataSet/Assertion/localizeContentRecordOfCategoryRelation.csv
219 public function localizeContentOfRelation()
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
];
226 * @see DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
228 public function localizeCategoryOfRelation()
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
];
235 * @see DataSet/Assertion/moveContentRecordOfCategoryRelationToDifferentPage.csv
237 public function moveContentOfRelationToDifferentPage()
239 $this->actionService
->moveRecord(self
::TABLE_Content
, self
::VALUE_ContentIdLast
, self
::VALUE_PageIdTarget
);
243 * @see DataSet/Assertion/copyPage.csv
245 public function copyPage()
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
];