[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / ManyToMany / Modify / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\Modify;
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 class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase {
21
22 /**
23 * @var string
24 */
25 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/';
26
27 /**
28 * MM Relations
29 */
30
31 /**
32 * @test
33 * @see DataSet/Assertion/addCategoryRelation.csv
34 */
35 public function addCategoryRelation() {
36 parent::addCategoryRelation();
37 $this->assertAssertionDataSet('addCategoryRelation');
38
39 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
40 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
41 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
42 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category A.A'));
43 }
44
45 /**
46 * @test
47 * @see DataSet/Assertion/deleteCategoryRelation.csv
48 */
49 public function deleteCategoryRelation() {
50 parent::deleteCategoryRelation();
51 $this->assertAssertionDataSet('deleteCategoryRelation');
52
53 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
54 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
55 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
56 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
57 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
58 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
59 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C', 'Category A.A'));
60 }
61
62 /**
63 * @test
64 * @see DataSet/Assertion/changeCategoryRelationSorting.csv
65 */
66 public function changeCategoryRelationSorting() {
67 parent::changeCategoryRelationSorting();
68 $this->assertAssertionDataSet('changeCategoryRelationSorting');
69
70 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
71 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
72 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
73 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
74 }
75
76 /**
77 * @test
78 * @see DataSet/Assertion/createContentRecordAndAddCategoryRelation.csv
79 */
80 public function createContentAndAddRelation() {
81 parent::createContentAndAddRelation();
82 $this->assertAssertionDataSet('createContentNAddRelation');
83
84 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
85 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
86 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
87 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
88 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
89 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B'));
90 }
91
92 /**
93 * @test
94 * @see DataSet/Assertion/createCategoryRecordAndAddCategoryRelation.csv
95 */
96 public function createCategoryAndAddRelation() {
97 parent::createCategoryAndAddRelation();
98 $this->assertAssertionDataSet('createCategoryNAddRelation');
99
100 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
101 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
102 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
103 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
104 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
105 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
106 }
107
108 /**
109 * @test
110 * @see DataSet/Assertion/createContentRecordAndCreateCategoryRelation.csv
111 */
112 public function createContentAndCreateRelation() {
113 parent::createContentAndCreateRelation();
114 $this->assertAssertionDataSet('createContentNCreateRelation');
115
116 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
117 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
118 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
119 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
120 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
121 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
122 }
123
124 /**
125 * @test
126 * @see DataSet/Assertion/createCategoryRecordAndCreateCategoryRelation.csv
127 */
128 public function createCategoryAndCreateRelation() {
129 parent::createCategoryAndCreateRelation();
130 $this->assertAssertionDataSet('createCategoryNCreateRelation');
131 }
132
133 /**
134 * @test
135 * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
136 */
137 public function modifyCategoryOfRelation() {
138 parent::modifyCategoryOfRelation();
139 $this->assertAssertionDataSet('modifyCategoryOfRelation');
140
141 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
142 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
143 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
144 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
145 }
146
147 /**
148 * @test
149 * @see DataSet/Assertion/modifyContentRecordOfCategoryRelation.csv
150 */
151 public function modifyContentOfRelation() {
152 parent::modifyContentOfRelation();
153 $this->assertAssertionDataSet('modifyContentOfRelation');
154
155 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
156 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
157 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
158 }
159
160 /**
161 * @test
162 * @see DataSet/Assertion/modifyBothRecordsOfCategoryRelation.csv
163 */
164 public function modifyBothsOfRelation() {
165 parent::modifyBothsOfRelation();
166 $this->assertAssertionDataSet('modifyBothsOfRelation');
167
168 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
169 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
170 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
171 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
172 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
173 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
174 }
175
176 /**
177 * @test
178 * @see DataSet/Assertion/deleteContentRecordOfCategoryRelation.csv
179 */
180 public function deleteContentOfRelation() {
181 parent::deleteContentOfRelation();
182 $this->assertAssertionDataSet('deleteContentOfRelation');
183
184 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
185 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
186 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
187 }
188
189 /**
190 * @test
191 * @see DataSet/Assertion/deleteCategoryRecordOfCategoryRelation.csv
192 */
193 public function deleteCategoryOfRelation() {
194 parent::deleteCategoryOfRelation();
195 $this->assertAssertionDataSet('deleteCategoryOfRelation');
196
197 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
198 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
199 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
200 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
201 }
202
203 /**
204 * @test
205 * @see DataSet/Assertion/copyContentRecordOfCategoryRelation.csv
206 */
207 public function copyContentOfRelation() {
208 parent::copyContentOfRelation();
209 $this->assertAssertionDataSet('copyContentOfRelation');
210
211 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
212 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
213 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
214 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
215 }
216
217 /**
218 * @test
219 * @see DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
220 */
221 public function copyCategoryOfRelation() {
222 parent::copyCategoryOfRelation();
223 $this->assertAssertionDataSet('copyCategoryOfRelation');
224
225 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
226 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
227 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
228 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
229 }
230
231 /**
232 * @test
233 * @see DataSet/Assertion/localizeContentRecordOfCategoryRelation.csv
234 */
235 public function localizeContentOfRelation() {
236 parent::localizeContentOfRelation();
237 $this->assertAssertionDataSet('localizeContentOfRelation');
238
239 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
240 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
241 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
242 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
243 }
244
245 /**
246 * @test
247 * @see DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
248 */
249 public function localizeCategoryOfRelation() {
250 parent::localizeCategoryOfRelation();
251 $this->assertAssertionDataSet('localizeCategoryOfRelation');
252
253 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
254 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
255 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
256 ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
257 }
258
259 /**
260 * @test
261 * @see DataSet/Assertion/moveContentRecordOfCategoryRelationToDifferentPage.csv
262 */
263 public function moveContentOfRelationToDifferentPage() {
264 parent::moveContentOfRelationToDifferentPage();
265 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
266
267 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
268 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
269 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
270 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
271 }
272
273 /**
274 * @test
275 * @see DataSet/Assertion/copyPage.csv
276 */
277 public function copyPage() {
278 parent::copyPage();
279 $this->assertAssertionDataSet('copyPage');
280
281 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
282 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
283 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
284 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
285 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
286 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
287 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
288 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
289 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
290 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
291 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
292 }
293
294 }