[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / Select / Publish / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Select\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\Select\AbstractActionTestCase {
21
22 /**
23 * @var string
24 */
25 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/Select/Publish/DataSet/';
26
27 /**
28 * Relations
29 */
30
31 /**
32 * @test
33 * @see DataSet/addElementRelation.csv
34 */
35 public function addElementRelation() {
36 parent::addElementRelation();
37 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
38 $this->assertAssertionDataSet('addElementRelation');
39
40 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
41 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
42 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
43 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2', 'Element #3'));
44 }
45
46 /**
47 * @test
48 * @see DataSet/deleteElementRelation.csv
49 */
50 public function deleteElementRelation() {
51 parent::deleteElementRelation();
52 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
53 $this->assertAssertionDataSet('deleteElementRelation');
54
55 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
56 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
57 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
58 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
59 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
60 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
61 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
62 }
63
64 /**
65 * @test
66 * @see DataSet/changeElementSorting.csv
67 */
68 public function changeElementSorting() {
69 parent::changeElementSorting();
70 $this->actionService->publishRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
71 $this->assertAssertionDataSet('changeElementSorting');
72
73 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
74 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
75 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
76 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
77 }
78
79 /**
80 * @test
81 * @see DataSet/changeElementRelationSorting.csv
82 */
83 public function changeElementRelationSorting() {
84 parent::changeElementRelationSorting();
85 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
86 $this->assertAssertionDataSet('changeElementRelationSorting');
87
88 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
89 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
90 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
91 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
92 }
93
94 /**
95 * @test
96 * @see DataSet/createContentNAddRelation.csv
97 */
98 public function createContentAndAddElementRelation() {
99 parent::createContentAndAddElementRelation();
100 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
101 $this->assertAssertionDataSet('createContentNAddRelation');
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 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
107 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
108 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
109 }
110
111 /**
112 * @test
113 * @see DataSet/createContentNCreateRelation.csv
114 */
115 public function createContentAndCreateElementRelation() {
116 parent::createContentAndCreateElementRelation();
117 $this->actionService->publishRecords(
118 array(
119 self::TABLE_Content => array($this->recordIds['newContentId']),
120 self::TABLE_Element => array($this->recordIds['newElementId']),
121 )
122 );
123 $this->assertAssertionDataSet('createContentNCreateRelation');
124
125 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
126 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
127 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
128 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
129 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
130 ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1'));
131 }
132
133 /**
134 * @test
135 * @see DataSet/modifyElementOfRelation.csv
136 */
137 public function modifyElementOfRelation() {
138 parent::modifyElementOfRelation();
139 $this->actionService->publishRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
140 $this->assertAssertionDataSet('modifyElementOfRelation');
141
142 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
143 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
144 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
145 ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
146 }
147
148 /**
149 * @test
150 * @see DataSet/modifyContentOfRelation.csv
151 */
152 public function modifyContentOfRelation() {
153 parent::modifyContentOfRelation();
154 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
155 $this->assertAssertionDataSet('modifyContentOfRelation');
156
157 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
158 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
159 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
160 }
161
162 /**
163 * @test
164 * @see DataSet/modifyBothSidesOfRelation.csv
165 */
166 public function modifyBothSidesOfRelation() {
167 parent::modifyBothSidesOfRelation();
168 $this->actionService->publishRecords(
169 array(
170 self::TABLE_Content => array(self::VALUE_ContentIdFirst),
171 self::TABLE_Element => array(self::VALUE_ElementIdFirst),
172 )
173 );
174 $this->assertAssertionDataSet('modifyBothSidesOfRelation');
175
176 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
177 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
178 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
179 ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
180 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
181 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
182 }
183
184 /**
185 * @test
186 * @see DataSet/deleteContentOfRelation.csv
187 */
188 public function deleteContentOfRelation() {
189 parent::deleteContentOfRelation();
190 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
191 $this->assertAssertionDataSet('deleteContentOfRelation');
192
193 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
194 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
195 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
196 }
197
198 /**
199 * @test
200 * @see DataSet/deleteElementOfRelation.csv
201 */
202 public function deleteElementOfRelation() {
203 parent::deleteElementOfRelation();
204 $this->actionService->publishRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
205 $this->assertAssertionDataSet('deleteElementOfRelation');
206
207 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
208 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
209 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
210 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
211 }
212
213 /**
214 * @test
215 * @see DataSet/copyContentOfRelation.csv
216 */
217 public function copyContentOfRelation() {
218 parent::copyContentOfRelation();
219 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['copiedContentId']);
220 $this->assertAssertionDataSet('copyContentOfRelation');
221
222 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
223 // Referenced elements are not copied with the "parent", which is expected and correct
224 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
225 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentElement)
226 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
227 }
228
229 /**
230 * @test
231 * @see DataSet/copyElementOfRelation.csv
232 */
233 public function copyElementOfRelation() {
234 parent::copyElementOfRelation();
235 $this->actionService->publishRecord(self::TABLE_Element, $this->recordIds['copiedElementId']);
236 $this->assertAssertionDataSet('copyElementOfRelation');
237
238 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
239 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
240 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
241 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
242 // Referenced elements are not updated at the "parent", which is expected and correct
243 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
244 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
245 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1 (copy 1)'));
246 }
247
248 /**
249 * @test
250 * @see DataSet/localizeContentOfRelation.csv
251 */
252 public function localizeContentOfRelation() {
253 parent::localizeContentOfRelation();
254 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
255 $this->assertAssertionDataSet('localizeContentOfRelation');
256
257 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
258 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
259 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
260 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
261 }
262
263 /**
264 * @test
265 * @see DataSet/localizeElementOfRelation.csv
266 */
267 public function localizeElementOfRelation() {
268 parent::localizeElementOfRelation();
269 $this->actionService->publishRecord(self::TABLE_Element, $this->recordIds['localizedElementId']);
270 $this->assertAssertionDataSet('localizeElementOfRelation');
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_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
275 ->setTable(self::TABLE_Element)->setField('title')->setValues('[Translate to Dansk:] Element #1', 'Element #2'));
276 }
277
278 /**
279 * @test
280 * @see DataSet/moveContentOfRelationToDifferentPage.csv
281 */
282 public function moveContentOfRelationToDifferentPage() {
283 parent::moveContentOfRelationToDifferentPage();
284 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
285 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
286
287 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
288 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
289 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
290 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
291 }
292
293 }