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