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