[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / ManyToMany / AbstractActionTestCase.php
1 <?php
2 namespace TYPO3\CMS\Core\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
30 const TABLE_Page = 'pages';
31 const TABLE_Content = 'tt_content';
32 const TABLE_Category = 'sys_category';
33 const TABLE_ContentCategory_ManyToMany = 'sys_category_record_mm';
34
35 /**
36 * @var string
37 */
38 protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/';
39
40 protected function setUp() {
41 parent::setUp();
42 $this->importScenarioDataSet('LiveDefaultPages');
43 $this->importScenarioDataSet('LiveDefaultElements');
44
45 $this->setUpFrontendRootPage(1, array('typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'));
46 $this->backendUser->workspace = 0;
47 }
48
49 /**
50 * MM Relations
51 */
52
53 /**
54 * @test
55 * @see DataSet/Assertion/addCategoryRelation.csv
56 */
57 public function addCategoryRelation() {
58 $this->actionService->modifyReferences(
59 self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdSecond, 31)
60 );
61 }
62
63 /**
64 * @test
65 * @see DataSet/Assertion/deleteCategoryRelation.csv
66 */
67 public function deleteCategoryRelation() {
68 $this->actionService->modifyReferences(
69 self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdFirst)
70 );
71 }
72
73 /**
74 * @test
75 * @see DataSet/Assertion/changeCategoryRelationSorting.csv
76 */
77 public function changeCategoryRelationSorting() {
78 $this->actionService->modifyReferences(
79 self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdFirst)
80 );
81 }
82
83 /**
84 * @test
85 * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
86 */
87 public function modifyCategoryOfRelation() {
88 $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, array('title' => 'Testing #1'));
89 }
90
91 /**
92 * @test
93 * @see DataSet/Assertion/modifyContentRecordOfCategoryRelation.csv
94 */
95 public function modifyContentOfRelation() {
96 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
97 }
98
99 /**
100 * @test
101 * @see DataSet/Assertion/modifyBothRecordsOfCategoryRelation.csv
102 */
103 public function modifyBothsOfRelation() {
104 $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, array('title' => 'Testing #1'));
105 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
106 }
107
108 /**
109 * @test
110 * @see DataSet/Assertion/deleteContentRecordOfCategoryRelation.csv
111 */
112 public function deleteContentOfRelation() {
113 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
114 }
115
116 /**
117 * @test
118 * @see DataSet/Assertion/deleteCategoryRecordOfCategoryRelation.csv
119 */
120 public function deleteCategoryOfRelation() {
121 $this->actionService->deleteRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst);
122 }
123
124 /**
125 * @test
126 * @see DataSet/Assertion/copyContentRecordOfCategoryRelation.csv
127 */
128 public function copyContentOfRelation() {
129 $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
130 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
131 }
132
133 /**
134 * @test
135 * @see DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
136 */
137 public function copyCategoryOfRelation() {
138 $this->actionService->copyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, 0);
139 }
140
141 /**
142 * @test
143 * @see DataSet/Assertion/localizeContentRecordOfCategoryRelation.csv
144 */
145 public function localizeContentOfRelation() {
146 $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
147 }
148
149 /**
150 * @test
151 * @see DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
152 */
153 public function localizeCategoryOfRelation() {
154 $this->actionService->localizeRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, self::VALUE_LanguageId);
155 }
156
157 /**
158 * @test
159 * @see DataSet/Assertion/moveContentRecordOfCategoryRelationToDifferentPage.csv
160 */
161 public function moveContentOfRelationToDifferentPage() {
162 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
163 }
164
165 /**
166 * @test
167 * @see DataSet/Assertion/copyPage.csv
168 */
169 public function copyPage() {
170 $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
171 $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
172 $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
173 $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
174 }
175
176 }