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