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