2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\Publish
;
5 * This file is part of the TYPO3 CMS project.
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.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
18 * Functional test for the DataHandler
20 class ActionTest
extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase
25 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/';
33 * @see DataSet/Assertion/addCategoryRelation.csv
35 public function addCategoryRelation()
37 parent
::addCategoryRelation();
38 $this->actionService
->publishRecord(self
::TABLE_Content
, self
::VALUE_ContentIdFirst
);
39 $this->assertAssertionDataSet('addCategoryRelation');
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'));
49 * @see DataSet/Assertion/deleteCategoryRelation.csv
51 public function deleteCategoryRelation()
53 parent
::deleteCategoryRelation();
54 $this->actionService
->publishRecord(self
::TABLE_Content
, self
::VALUE_ContentIdFirst
);
55 $this->assertAssertionDataSet('deleteCategoryRelation');
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'));
68 * @see DataSet/Assertion/changeCategoryRelationSorting.csv
70 public function changeCategoryRelationSorting()
72 parent
::changeCategoryRelationSorting();
73 $this->actionService
->publishRecord(self
::TABLE_Content
, self
::VALUE_ContentIdFirst
);
74 $this->assertAssertionDataSet('changeCategoryRelationSorting');
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'));
84 * @see DataSet/Assertion/createContentRecordAndAddCategoryRelation.csv
86 public function createContentAndAddRelation()
88 parent
::createContentAndAddRelation();
89 $this->actionService
->publishRecord(self
::TABLE_Content
, $this->recordIds
['newContentId']);
90 $this->assertAssertionDataSet('createContentNAddRelation');
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'));
102 * @see DataSet/Assertion/createCategoryRecordAndAddCategoryRelation.csv
104 public function createCategoryAndAddRelation()
106 parent
::createCategoryAndAddRelation();
107 $this->actionService
->publishRecord(self
::TABLE_Category
, $this->recordIds
['newCategoryId']);
108 $this->assertAssertionDataSet('createCategoryNAddRelation');
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'));
120 * @see DataSet/Assertion/createContentRecordAndCreateCategoryRelation.csv
122 public function createContentAndCreateRelation()
124 parent
::createContentAndCreateRelation();
125 $this->actionService
->publishRecords(
127 self
::TABLE_Category
=> array($this->recordIds
['newCategoryId']),
128 self
::TABLE_Content
=> array($this->recordIds
['newContentId']),
131 $this->assertAssertionDataSet('createContentNCreateRelation');
133 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, 0)->getResponseSections();
134 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
135 ->setTable(self
::TABLE_Content
)->setField('header')->setValues('Testing #1'));
136 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
137 ->setRecordIdentifier(self
::TABLE_Content
. ':' . $this->recordIds
['newContentId'])->setRecordField('categories')
138 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Testing #1'));
143 * @see DataSet/Assertion/createCategoryRecordAndCreateCategoryRelation.csv
145 public function createCategoryAndCreateRelation()
147 parent
::createCategoryAndCreateRelation();
148 $this->actionService
->publishRecords(
150 self
::TABLE_Content
=> array($this->recordIds
['newContentId']),
151 self
::TABLE_Category
=> array($this->recordIds
['newCategoryId']),
154 $this->actionService
->publishWorkspace(self
::VALUE_WorkspaceId
);
155 $this->assertAssertionDataSet('createCategoryNCreateRelation');
160 * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
162 public function modifyCategoryOfRelation()
164 parent
::modifyCategoryOfRelation();
165 $this->actionService
->publishRecord(self
::TABLE_Category
, self
::VALUE_CategoryIdFirst
);
166 $this->assertAssertionDataSet('modifyCategoryOfRelation');
168 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, 0)->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'));
176 * @see DataSet/Assertion/modifyContentRecordOfCategoryRelation.csv
178 public function modifyContentOfRelation()
180 parent
::modifyContentOfRelation();
181 $this->actionService
->publishRecord(self
::TABLE_Content
, self
::VALUE_ContentIdFirst
);
182 $this->assertAssertionDataSet('modifyContentOfRelation');
184 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, 0)->getResponseSections();
185 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
186 ->setTable(self
::TABLE_Content
)->setField('header')->setValues('Testing #1'));
191 * @see DataSet/Assertion/modifyBothRecordsOfCategoryRelation.csv
193 public function modifyBothsOfRelation()
195 parent
::modifyBothsOfRelation();
196 $this->actionService
->publishRecords(
198 self
::TABLE_Content
=> array(self
::VALUE_ContentIdFirst
),
199 self
::TABLE_Category
=> array(self
::VALUE_CategoryIdFirst
),
202 $this->assertAssertionDataSet('modifyBothsOfRelation');
204 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, 0)->getResponseSections();
205 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
206 ->setRecordIdentifier(self
::TABLE_Content
. ':' . self
::VALUE_ContentIdFirst
)->setRecordField('categories')
207 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Testing #1', 'Category B'));
208 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
209 ->setTable(self
::TABLE_Content
)->setField('header')->setValues('Testing #1'));
214 * @see DataSet/Assertion/deleteContentRecordOfCategoryRelation.csv
216 public function deleteContentOfRelation()
218 parent
::deleteContentOfRelation();
219 $this->actionService
->publishRecord(self
::TABLE_Content
, self
::VALUE_ContentIdLast
);
220 $this->assertAssertionDataSet('deleteContentOfRelation');
222 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, 0)->getResponseSections();
223 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
224 ->setTable(self
::TABLE_Content
)->setField('header')->setValues('Testing #1'));
229 * @see DataSet/Assertion/deleteCategoryRecordOfCategoryRelation.csv
231 public function deleteCategoryOfRelation()
233 parent
::deleteCategoryOfRelation();
234 $this->actionService
->publishRecord(self
::TABLE_Category
, self
::VALUE_CategoryIdFirst
);
235 $this->assertAssertionDataSet('deleteCategoryOfRelation');
237 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, 0)->getResponseSections();
238 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
239 ->setRecordIdentifier(self
::TABLE_Content
. ':' . self
::VALUE_ContentIdFirst
)->setRecordField('categories')
240 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Category A'));
245 * @see DataSet/Assertion/copyContentRecordOfCategoryRelation.csv
247 public function copyContentOfRelation()
249 parent
::copyContentOfRelation();
250 $this->actionService
->publishRecord(self
::TABLE_Content
, $this->recordIds
['newContentId']);
251 $this->assertAssertionDataSet('copyContentOfRelation');
253 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, 0)->getResponseSections();
254 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
255 ->setRecordIdentifier(self
::TABLE_Content
. ':' . $this->recordIds
['newContentId'])->setRecordField('categories')
256 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Category B', 'Category C'));
261 * @see DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
263 public function copyCategoryOfRelation()
265 parent
::copyCategoryOfRelation();
266 $this->actionService
->publishRecord(self
::TABLE_Category
, $this->recordIds
['newCategoryId']);
267 $this->assertAssertionDataSet('copyCategoryOfRelation');
269 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, 0)->getResponseSections();
270 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
271 ->setRecordIdentifier(self
::TABLE_Content
. ':' . self
::VALUE_ContentIdFirst
)->setRecordField('categories')
272 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
277 * @see DataSet/Assertion/localizeContentRecordOfCategoryRelation.csv
279 public function localizeContentOfRelation()
281 parent
::localizeContentOfRelation();
282 $this->actionService
->publishRecord(self
::TABLE_Content
, $this->recordIds
['localizedContentId']);
283 $this->assertAssertionDataSet('localizeContentOfRelation');
285 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, self
::VALUE_LanguageId
)->getResponseSections();
286 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
287 ->setRecordIdentifier(self
::TABLE_Content
. ':' . self
::VALUE_ContentIdLast
)->setRecordField('categories')
288 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Category B', 'Category C'));
293 * @see DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
295 public function localizeCategoryOfRelation()
297 parent
::localizeCategoryOfRelation();
298 $this->actionService
->publishRecord(self
::TABLE_Category
, $this->recordIds
['localizedCategoryId']);
299 $this->assertAssertionDataSet('localizeCategoryOfRelation');
301 $responseSections = $this->getFrontendResponse(self
::VALUE_PageId
, self
::VALUE_LanguageId
)->getResponseSections();
302 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
303 ->setRecordIdentifier(self
::TABLE_Content
. ':' . self
::VALUE_ContentIdFirst
)->setRecordField('categories')
304 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
309 * @see DataSet/Assertion/moveContentRecordOfCategoryRelationToDifferentPage.csv
311 public function moveContentOfRelationToDifferentPage()
313 parent
::moveContentOfRelationToDifferentPage();
314 $this->actionService
->publishRecord(self
::TABLE_Content
, self
::VALUE_ContentIdLast
);
315 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
317 $responseSections = $this->getFrontendResponse(self
::VALUE_PageIdTarget
, 0)->getResponseSections();
318 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
319 ->setRecordIdentifier(self
::TABLE_Content
. ':' . self
::VALUE_ContentIdLast
)->setRecordField('categories')
320 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Category B', 'Category C'));
325 * @see DataSet/Assertion/copyPage.csv
327 public function copyPage()
330 $this->actionService
->publishRecords(
332 self
::TABLE_Page
=> array($this->recordIds
['newPageId']),
333 self
::TABLE_Content
=> array($this->recordIds
['newContentIdFirst'], $this->recordIds
['newContentIdLast']),
336 $this->assertAssertionDataSet('copyPage');
338 $responseSections = $this->getFrontendResponse($this->recordIds
['newPageId'])->getResponseSections();
339 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
340 ->setTable(self
::TABLE_Page
)->setField('title')->setValues('Relations'));
341 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
342 ->setTable(self
::TABLE_Content
)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
343 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
344 ->setRecordIdentifier(self
::TABLE_Content
. ':' . $this->recordIds
['newContentIdFirst'])->setRecordField('categories')
345 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Category A', 'Category B'));
346 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
347 ->setRecordIdentifier(self
::TABLE_Content
. ':' . $this->recordIds
['newContentIdLast'])->setRecordField('categories')
348 ->setTable(self
::TABLE_Category
)->setField('title')->setValues('Category B', 'Category C'));