[TASK] Re-work/simplify copyright header in PHP files - Part 4
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / Select / Modify / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\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\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase {
23
24 /**
25 * @var string
26 */
27 protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Select/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)->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)->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)->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)->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)->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)->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)->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)->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)->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)->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)->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)->getResponseSections();
203 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
204 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentElement)
205 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
206 }
207
208 /**
209 * @test
210 * @see DataSet/copyElementOfRelation.csv
211 */
212 public function copyElementOfRelation() {
213 parent::copyElementOfRelation();
214 $this->assertAssertionDataSet('copyElementOfRelation');
215
216 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
217 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
218 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
219 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
220 // Referenced elements are not updated at the "parent", which is expected and correct
221 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
222 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
223 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1 (copy 1)'));
224 }
225
226 /**
227 * @test
228 * @see DataSet/localizeContentOfRelation.csv
229 */
230 public function localizeContentOfRelation() {
231 parent::localizeContentOfRelation();
232 $this->assertAssertionDataSet('localizeContentOfRelation');
233
234 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
235 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
236 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
237 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
238 }
239
240 /**
241 * @test
242 * @see DataSet/localizeElementOfRelation.csv
243 */
244 public function localizeElementOfRelation() {
245 parent::localizeElementOfRelation();
246 $this->assertAssertionDataSet('localizeElementOfRelation');
247
248 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
249 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
250 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
251 ->setTable(self::TABLE_Element)->setField('title')->setValues('[Translate to Dansk:] Element #1', 'Element #2'));
252 }
253
254 /**
255 * @test
256 * @see DataSet/moveContentOfRelationToDifferentPage.csv
257 */
258 public function moveContentOfRelationToDifferentPage() {
259 parent::moveContentOfRelationToDifferentPage();
260 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
261
262 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
263 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
264 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
265 ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
266 }
267
268 }