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