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