[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / Group / PublishAll / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Group\PublishAll;
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\Group\AbstractActionTestCase {
21
22 /**
23 * @var string
24 */
25 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/Group/PublishAll/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->publishWorkspace(self::VALUE_WorkspaceId);
38 $this->assertAssertionDataSet('addElementRelation');
39
40 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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->publishWorkspace(self::VALUE_WorkspaceId);
53 $this->assertAssertionDataSet('deleteElementRelation');
54
55 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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->publishWorkspace(self::VALUE_WorkspaceId);
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->publishWorkspace(self::VALUE_WorkspaceId);
86 $this->assertAssertionDataSet('changeElementRelationSorting');
87
88 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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->publishWorkspace(self::VALUE_WorkspaceId);
101 $this->assertAssertionDataSet('createContentNAddRelation');
102
103 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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->publishWorkspace(self::VALUE_WorkspaceId);
118 $this->assertAssertionDataSet('createContentNCreateRelation');
119
120 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
121 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
122 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
123 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
124 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
125 ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1'));
126 }
127
128 /**
129 * @test
130 * @see DataSet/modifyElementOfRelation.csv
131 */
132 public function modifyElementOfRelation() {
133 parent::modifyElementOfRelation();
134 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
135 $this->assertAssertionDataSet('modifyElementOfRelation');
136
137 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
138 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
139 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
140 ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
141 }
142
143 /**
144 * @test
145 * @see DataSet/modifyContentOfRelation.csv
146 */
147 public function modifyContentOfRelation() {
148 parent::modifyContentOfRelation();
149 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
150 $this->assertAssertionDataSet('modifyContentOfRelation');
151
152 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
153 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
154 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
155 }
156
157 /**
158 * @test
159 * @see DataSet/modifyBothSidesOfRelation.csv
160 */
161 public function modifyBothSidesOfRelation() {
162 parent::modifyBothSidesOfRelation();
163 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
164 $this->assertAssertionDataSet('modifyBothSidesOfRelation');
165
166 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
167 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
168 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
169 ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
170 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
171 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
172 }
173
174 /**
175 * @test
176 * @see DataSet/deleteContentOfRelation.csv
177 */
178 public function deleteContentOfRelation() {
179 parent::deleteContentOfRelation();
180 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
181 $this->assertAssertionDataSet('deleteContentOfRelation');
182
183 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
184 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
185 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
186 }
187
188 /**
189 * @test
190 * @see DataSet/deleteElementOfRelation.csv
191 */
192 public function deleteElementOfRelation() {
193 parent::deleteElementOfRelation();
194 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
195 $this->assertAssertionDataSet('deleteElementOfRelation');
196
197 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
198 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
199 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
200 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
201 }
202
203 /**
204 * @test
205 * @see DataSet/copyContentOfRelation.csv
206 */
207 public function copyContentOfRelation() {
208 parent::copyContentOfRelation();
209 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
210 $this->assertAssertionDataSet('copyContentOfRelation');
211
212 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
213 // Referenced elements are not copied with the "parent", which is expected and correct
214 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
215 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentElement)
216 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
217 }
218
219 /**
220 * @test
221 * @see DataSet/copyElementOfRelation.csv
222 */
223 public function copyElementOfRelation() {
224 parent::copyElementOfRelation();
225 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
226 $this->assertAssertionDataSet('copyElementOfRelation');
227
228 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
229 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
230 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
231 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
232 // Referenced elements are not updated at the "parent", which is expected and correct
233 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
234 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
235 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1 (copy 1)'));
236 }
237
238 /**
239 * @test
240 * @see DataSet/localizeContentOfRelation.csv
241 */
242 public function localizeContentOfRelation() {
243 parent::localizeContentOfRelation();
244 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
245 $this->assertAssertionDataSet('localizeContentOfRelation');
246
247 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
248 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
249 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
250 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
251 }
252
253 /**
254 * @test
255 * @see DataSet/localizeElementOfRelation.csv
256 */
257 public function localizeElementOfRelation() {
258 parent::localizeElementOfRelation();
259 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
260 $this->assertAssertionDataSet('localizeElementOfRelation');
261
262 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
263 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
264 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
265 ->setTable(self::TABLE_Element)->setField('title')->setValues('[Translate to Dansk:] Element #1', 'Element #2'));
266 }
267
268 /**
269 * @test
270 * @see DataSet/moveContentOfRelationToDifferentPage.csv
271 */
272 public function moveContentOfRelationToDifferentPage() {
273 parent::moveContentOfRelationToDifferentPage();
274 $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
275 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
276
277 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
278 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
279 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
280 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
281 }
282
283 }