[TASK] Re-work/simplify copyright header in PHP files - Part 4
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / FAL / Modify / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\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\FAL\AbstractActionTestCase {
23
24 /**
25 * @var string
26 */
27 protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/';
28
29 /**
30 * Content records
31 */
32
33 /**
34 * @test
35 * @see DataSet/Assertion/modifyContentRecord.csv
36 */
37 public function modifyContent() {
38 parent::modifyContent();
39 $this->assertAssertionDataSet('modifyContent');
40
41 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
42 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
43 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
44 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
45 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
46 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD'));
47 }
48
49 /**
50 * @test
51 * @see DataSet/Assertion/deleteContentRecord.csv
52 */
53 public function deleteContent() {
54 parent::deleteContent();
55 $this->assertAssertionDataSet('deleteContent');
56
57 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
58 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
59 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
60 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
61 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
62 }
63
64 /**
65 * @test
66 * @see DataSet/Assertion/copyContentRecord.csv
67 */
68 public function copyContent() {
69 parent::copyContent();
70 $this->assertAssertionDataSet('copyContent');
71
72 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
73 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
74 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
75 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
76 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentImage)
77 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD'));
78 }
79
80 /**
81 * @test
82 * @see DataSet/Assertion/localizeContentRecord.csv
83 */
84 public function localizeContent() {
85 parent::localizeContent();
86 $this->assertAssertionDataSet('localizeContent');
87
88 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
89 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
90 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
91
92 // @todo Values in sys_file_reference are not copied during localization...
93 /*
94 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
95 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
96 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD'));
97 */
98 }
99
100 /**
101 * @test
102 * @see DataSet/Assertion/changeContentRecordSorting.csv
103 */
104 public function changeContentSorting() {
105 parent::changeContentSorting();
106 $this->assertAssertionDataSet('changeContentSorting');
107
108 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
109 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
110 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
111 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
112 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
113 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD'));
114 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
115 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
116 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD'));
117 }
118
119 /**
120 * @test
121 * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
122 */
123 public function moveContentToDifferentPage() {
124 parent::moveContentToDifferentPage();
125 $this->assertAssertionDataSet('moveContentToDifferentPage');
126
127 $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
128 $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
129 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
130 $this->assertThat($responseSectionsSource, $this->getRequestSectionStructureHasRecordConstraint()
131 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
132 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD'));
133 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
134 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
135 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
136 $this->assertThat($responseSectionsTarget, $this->getRequestSectionStructureHasRecordConstraint()
137 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
138 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD'));
139 }
140
141 /**
142 * @test
143 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
144 */
145 public function moveContentToDifferentPageAndChangeSorting() {
146 parent::moveContentToDifferentPageAndChangeSorting();
147 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
148
149 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
150 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
151 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
152 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
153 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
154 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD'));
155 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
156 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
157 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD'));
158 }
159
160 /**
161 * File references
162 */
163
164 /**
165 * @test
166 * @see DataSets/createContentWFileReference.csv
167 */
168 public function createContentWithFileReference() {
169 parent::createContentWithFileReference();
170 $this->assertAssertionDataSet('createContentWFileReference');
171
172 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
173 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
174 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
175 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
176 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentImage)
177 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Image #1'));
178 }
179
180 /**
181 * @test
182 * @see DataSets/modifyContentWFileReference.csv
183 */
184 public function modifyContentWithFileReference() {
185 parent::modifyContentWithFileReference();
186 $this->assertAssertionDataSet('modifyContentWFileReference');
187
188 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
189 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
190 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
191 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
192 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
193 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'Image #1'));
194 }
195
196 /**
197 * @test
198 * @see DataSets/modifyContentNAddFileReference.csv
199 */
200 public function modifyContentAndAddFileReference() {
201 parent::modifyContentAndAddFileReference();
202 $this->assertAssertionDataSet('modifyContentNAddFileReference');
203
204 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
205 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
206 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
207 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper', 'Image #3'));
208 }
209
210 /**
211 * @test
212 * @see DataSets/modifyContentNDeleteFileReference.csv
213 */
214 public function modifyContentAndDeleteFileReference() {
215 parent::modifyContentAndDeleteFileReference();
216 $this->assertAssertionDataSet('modifyContentNDeleteFileReference');
217
218 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
219 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
220 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
221 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper'));
222 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
223 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
224 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD'));
225 }
226
227 /**
228 * @test
229 * @see DataSets/modifyContentNDeleteAllFileReference.csv
230 */
231 public function modifyContentAndDeleteAllFileReference() {
232 parent::modifyContentAndDeleteAllFileReference();
233 $this->assertAssertionDataSet('modifyContentNDeleteAllFileReference');
234
235 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
236 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
237 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
238 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper'));
239 }
240
241 }