[TASK] Take care of rendering warnings in core Changelog rendering
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / ManyToMany / Modify / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Core\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\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase
21 {
22 /**
23 * @var string
24 */
25 protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/';
26
27 /**
28 * MM Relations
29 */
30
31 /**
32 * @test
33 * @see DataSet/addCategoryRelation.csv
34 */
35 public function addCategoryRelation()
36 {
37 parent::addCategoryRelation();
38 $this->assertAssertionDataSet('addCategoryRelation');
39
40 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
41 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
42 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
43 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category A.A'));
44 }
45
46 /**
47 * @test
48 * @see DataSet/deleteCategoryRelation.csv
49 */
50 public function deleteCategoryRelation()
51 {
52 parent::deleteCategoryRelation();
53 $this->assertAssertionDataSet('deleteCategoryRelation');
54
55 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
56 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
57 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
58 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
59 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
60 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
61 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C', 'Category A.A'));
62 }
63
64 /**
65 * @test
66 * @see DataSet/changeCategoryRelationSorting.csv
67 */
68 public function changeCategoryRelationSorting()
69 {
70 parent::changeCategoryRelationSorting();
71 $this->assertAssertionDataSet('changeCategoryRelationSorting');
72
73 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
74 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
75 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
76 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
77 }
78
79 /**
80 * @test
81 * @see DataSet/modifyCategoryRecordOfCategoryRelation.csv
82 */
83 public function modifyCategoryOfRelation()
84 {
85 parent::modifyCategoryOfRelation();
86 $this->assertAssertionDataSet('modifyCategoryOfRelation');
87
88 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
89 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
90 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
91 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
92 }
93
94 /**
95 * @test
96 * @see DataSet/modifyContentRecordOfCategoryRelation.csv
97 */
98 public function modifyContentOfRelation()
99 {
100 parent::modifyContentOfRelation();
101 $this->assertAssertionDataSet('modifyContentOfRelation');
102
103 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
104 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
105 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
106 }
107
108 /**
109 * @test
110 * @see DataSet/modifyBothRecordsOfCategoryRelation.csv
111 */
112 public function modifyBothsOfRelation()
113 {
114 parent::modifyBothsOfRelation();
115 $this->assertAssertionDataSet('modifyBothsOfRelation');
116
117 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
118 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
119 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
120 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
121 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
122 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
123 }
124
125 /**
126 * @test
127 * @see DataSet/deleteContentRecordOfCategoryRelation.csv
128 */
129 public function deleteContentOfRelation()
130 {
131 parent::deleteContentOfRelation();
132 $this->assertAssertionDataSet('deleteContentOfRelation');
133
134 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
135 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
136 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
137 }
138
139 /**
140 * @test
141 * @see DataSet/deleteCategoryRecordOfCategoryRelation.csv
142 */
143 public function deleteCategoryOfRelation()
144 {
145 parent::deleteCategoryOfRelation();
146 $this->assertAssertionDataSet('deleteCategoryOfRelation');
147
148 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
149 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
150 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
151 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
152 }
153
154 /**
155 * @test
156 * @see DataSet/copyContentRecordOfCategoryRelation.csv
157 */
158 public function copyContentOfRelation()
159 {
160 parent::copyContentOfRelation();
161 $this->assertAssertionDataSet('copyContentOfRelation');
162
163 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
164 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
165 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
166 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
167 }
168
169 /**
170 * @test
171 * @see DataSet/copyCategoryRecordOfCategoryRelation.csv
172 */
173 public function copyCategoryOfRelation()
174 {
175 parent::copyCategoryOfRelation();
176 $this->assertAssertionDataSet('copyCategoryOfRelation');
177
178 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
179 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
180 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
181 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
182 }
183
184 /**
185 * @test
186 * @see DataSet/copyContentToLanguageOfRelation.csv
187 */
188 public function copyContentToLanguageOfRelation()
189 {
190 parent::copyContentToLanguageOfRelation();
191 $this->assertAssertionDataSet('copyContentToLanguageOfRelation');
192
193 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
194 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
195 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
196 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
197 }
198
199 /**
200 * @test
201 * @see DataSet/copyCategoryToLanguageOfRelation.csv
202 */
203 public function copyCategoryToLanguageOfRelation()
204 {
205 parent::copyCategoryToLanguageOfRelation();
206 $this->assertAssertionDataSet('copyCategoryToLanguageOfRelation');
207 //in this case the translated element is orphaned (no CE with relation to it, and it has no l10n_parent)
208 //so on frontend there is no change.
209 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
210 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
211 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
212 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
213 }
214
215 /**
216 * @test
217 * @see DataSet/localizeContentRecordOfCategoryRelation.csv
218 */
219 public function localizeContentOfRelation()
220 {
221 parent::localizeContentOfRelation();
222 $this->assertAssertionDataSet('localizeContentOfRelation');
223
224 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
225 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
226 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
227 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
228 }
229
230 /**
231 * @test
232 * @see DataSet/localizeContentOfRelationWSynchronization.csv
233 */
234 public function localizeContentOfRelationWithLanguageSynchronization()
235 {
236 parent::localizeContentOfRelationWithLanguageSynchronization();
237 $this->assertAssertionDataSet('localizeContentOfRelationWSynchronization');
238
239 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->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/localizeContentOfRelationNAddCategoryWSynchronization.csv
248 */
249 public function localizeContentOfRelationAndAddCategoryWithLanguageSynchronization()
250 {
251 parent::localizeContentOfRelationAndAddCategoryWithLanguageSynchronization();
252 $this->assertAssertionDataSet('localizeContentOfRelationNAddCategoryWSynchronization');
253
254 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
255 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
256 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
257 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C', 'Category A.A'));
258 }
259
260 /**
261 * @test
262 * @see DataSet/localizeContentChainOfRelationNAddCategoryWSynchronization.csv
263 */
264 public function localizeContentChainOfRelationAndAddCategoryWithLanguageSynchronization()
265 {
266 parent::localizeContentChainOfRelationAndAddCategoryWithLanguageSynchronization();
267 $this->assertAssertionDataSet('localizeContentChainOfRelationNAddCategoryWSynchronization');
268
269 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageIdSecond)->getResponseSections();
270 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
271 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
272 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C', 'Category A.A'));
273 }
274
275 /**
276 * @test
277 * @see DataSet/localizeCategoryRecordOfCategoryRelation.csv
278 */
279 public function localizeCategoryOfRelation()
280 {
281 // Create translated page first
282 $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
283 parent::localizeCategoryOfRelation();
284 $this->assertAssertionDataSet('localizeCategoryOfRelation');
285
286 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
287 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
288 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
289 ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
290 }
291
292 /**
293 * @test
294 * @see DataSet/moveContentRecordOfCategoryRelationToDifferentPage.csv
295 */
296 public function moveContentOfRelationToDifferentPage()
297 {
298 parent::moveContentOfRelationToDifferentPage();
299 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
300
301 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
302 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
303 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
304 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
305 }
306
307 /**
308 * @test
309 * @see DataSet/copyPage.csv
310 */
311 public function copyPage()
312 {
313 parent::copyPage();
314 $this->assertAssertionDataSet('copyPage');
315
316 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
317 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
318 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
319 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
320 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
321 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
322 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
323 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
324 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
325 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
326 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
327 }
328 }