[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / FAL / Modify / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\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\Workspaces\Tests\Functional\DataHandling\FAL\AbstractActionTestCase {
23
24 /**
25 * @var string
26 */
27 protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/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, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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')->setStrict(TRUE));
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, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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')->setStrict(TRUE));
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, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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')->setStrict(TRUE));
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, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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')->setStrict(TRUE));
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, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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')->setStrict(TRUE));
133
134 $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
135 $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
136 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
137 $this->assertThat($responseSectionsTarget, $this->getRequestSectionStructureHasRecordConstraint()
138 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
139 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
140 }
141
142 /**
143 * @test
144 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
145 */
146 public function moveContentToDifferentPageAndChangeSorting() {
147 parent::moveContentToDifferentPageAndChangeSorting();
148 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
149
150 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
151 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
152 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
153 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
154 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
155 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(TRUE));
156 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
157 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
158 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
159 }
160
161 /**
162 * File references
163 */
164
165 /**
166 * @test
167 * @see DataSets/createContentWFileReference.csv
168 */
169 public function createContentWithFileReference() {
170 parent::createContentWithFileReference();
171 $this->assertAssertionDataSet('createContentWFileReference');
172
173 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
174 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
175 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
176 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
177 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentImage)
178 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Image #1')->setStrict(TRUE));
179 }
180
181 /**
182 * @test
183 * @see DataSets/modifyContentWFileReference.csv
184 */
185 public function modifyContentWithFileReference() {
186 parent::modifyContentWithFileReference();
187 $this->assertAssertionDataSet('modifyContentWFileReference');
188
189 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
190 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
191 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
192 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
193 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
194 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'Image #1')->setStrict(TRUE));
195 }
196
197 /**
198 * @test
199 * @see DataSets/modifyContentNAddFileReference.csv
200 */
201 public function modifyContentAndAddFileReference() {
202 parent::modifyContentAndAddFileReference();
203 $this->assertAssertionDataSet('modifyContentNAddFileReference');
204
205 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
206 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
207 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
208 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper', 'Image #3')->setStrict(TRUE));
209 }
210
211 /**
212 * @test
213 * @see DataSets/modifyContentNDeleteFileReference.csv
214 */
215 public function modifyContentAndDeleteFileReference() {
216 parent::modifyContentAndDeleteFileReference();
217 $this->assertAssertionDataSet('modifyContentNDeleteFileReference');
218
219 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
220 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
221 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
222 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper')->setStrict(TRUE));
223 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
224 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
225 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD'));
226 }
227
228 /**
229 * @test
230 * @see DataSets/modifyContentNDeleteAllFileReference.csv
231 */
232 public function modifyContentAndDeleteAllFileReference() {
233 parent::modifyContentAndDeleteAllFileReference();
234 $this->assertAssertionDataSet('modifyContentNDeleteAllFileReference');
235
236 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
237 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
238 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
239 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper'));
240 }
241
242 }