[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / Group / AbstractActionTestCase.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Group;
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_ElementIdFirst = 1;
28 const VALUE_ElementIdSecond = 2;
29 const VALUE_ElementIdThird = 3;
30
31 const TABLE_Content = 'tt_content';
32 const TABLE_Element = 'tx_testdatahandler_element';
33
34 const FIELD_ContentElement = 'tx_testdatahandler_group';
35
36 /**
37 * @var string
38 */
39 protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Group/DataSet/';
40
41 protected function setUp() {
42 $this->testExtensionsToLoad[] = 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler';
43
44 parent::setUp();
45 $this->importScenarioDataSet('LiveDefaultPages');
46 $this->importScenarioDataSet('LiveDefaultElements');
47 $this->importScenarioDataSet('ReferenceIndex');
48
49 $this->setUpFrontendRootPage(1, array('typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'));
50 }
51
52 /**
53 * Relations
54 */
55
56 /**
57 * @test
58 * @see DataSet/addElementRelation.csv
59 */
60 public function addElementRelation() {
61 $this->actionService->modifyReferences(
62 self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, array(self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond, self::VALUE_ElementIdThird)
63 );
64 }
65
66 /**
67 * @test
68 * @see DataSet/deleteElementRelation.csv
69 */
70 public function deleteElementRelation() {
71 $this->actionService->modifyReferences(
72 self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, array(self::VALUE_ElementIdFirst)
73 );
74 }
75
76 /**
77 * @test
78 * @see DataSet/changeElementSorting.csv
79 */
80 public function changeElementSorting() {
81 $this->actionService->moveRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, -self::VALUE_ElementIdSecond);
82 }
83
84 /**
85 * @test
86 * @see DataSet/changeElementRelationSorting.csv
87 */
88 public function changeElementRelationSorting() {
89 $this->actionService->modifyReferences(
90 self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, array(self::VALUE_ElementIdSecond, self::VALUE_ElementIdFirst)
91 );
92 }
93
94 /**
95 * @test
96 * @see DataSet/createContentNAddRelation.csv
97 */
98 public function createContentAndAddElementRelation() {
99 $newTableIds = $this->actionService->createNewRecord(
100 self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1', self::FIELD_ContentElement => self::VALUE_ElementIdFirst)
101 );
102 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
103 }
104
105 /**
106 * @test
107 * @see DataSet/createContentNCreateRelation.csv
108 */
109 public function createContentAndCreateElementRelation() {
110 $newElementIds = $this->actionService->createNewRecord(self::TABLE_Element, self::VALUE_PageId, array('title' => 'Testing #1'));
111 $this->recordIds['newElementId'] = $newElementIds[self::TABLE_Element][0];
112 // It's not possible to use "NEW..." values for the TCA type 'group'
113 $newContentIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1', self::FIELD_ContentElement => $this->recordIds['newElementId']));
114 $this->recordIds['newContentId'] = $newContentIds[self::TABLE_Content][0];
115 }
116
117 /**
118 * @test
119 * @see DataSet/modifyElementOfRelation.csv
120 */
121 public function modifyElementOfRelation() {
122 $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, array('title' => 'Testing #1'));
123 }
124
125 /**
126 * @test
127 * @see DataSet/modifyContentOfRelation.csv
128 */
129 public function modifyContentOfRelation() {
130 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
131 }
132
133 /**
134 * @test
135 * @see DataSet/modifyBothSidesOfRelation.csv
136 */
137 public function modifyBothSidesOfRelation() {
138 $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, array('title' => 'Testing #1'));
139 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
140 }
141
142 /**
143 * @test
144 * @see DataSet/deleteContentOfRelation.csv
145 */
146 public function deleteContentOfRelation() {
147 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
148 }
149
150 /**
151 * @test
152 * @see DataSet/deleteElementOfRelation.csv
153 */
154 public function deleteElementOfRelation() {
155 $this->actionService->deleteRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
156 }
157
158 /**
159 * @test
160 * @see DataSet/copyContentOfRelation.csv
161 */
162 public function copyContentOfRelation() {
163 $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
164 $this->recordIds['copiedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
165 }
166
167 /**
168 * @test
169 * @see DataSet/copyElementOfRelation.csv
170 */
171 public function copyElementOfRelation() {
172 $newTableIds = $this->actionService->copyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_PageId);
173 $this->recordIds['copiedElementId'] = $newTableIds[self::TABLE_Element][self::VALUE_ElementIdFirst];
174 }
175
176 /**
177 * @test
178 * @see DataSet/localizeContentOfRelation.csv
179 */
180 public function localizeContentOfRelation() {
181 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
182 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
183 }
184
185 /**
186 * @test
187 * @see DataSet/localizeElementOfRelation.csv
188 */
189 public function localizeElementOfRelation() {
190 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
191 $this->recordIds['localizedElementId'] = $newTableIds[self::TABLE_Element][self::VALUE_ElementIdFirst];
192 }
193
194 /**
195 * @test
196 * @see DataSet/moveContentOfRelationToDifferentPage.csv
197 */
198 public function moveContentOfRelationToDifferentPage() {
199 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
200 }
201
202 }