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