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