[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Tests / Functional / DataHandling / FAL / Publish / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\FAL\Publish;
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/Publish/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->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
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->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
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->publishRecord(self::TABLE_Content, $this->recordIds['copiedContentId']);
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->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
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->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
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->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
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->publishRecords(
152 array(
153 self::TABLE_Content => array(self::VALUE_ContentIdFirst, self::VALUE_ContentIdLast),
154 )
155 );
156 $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
157
158 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
159 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
160 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
161 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
162 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
163 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(TRUE));
164 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
165 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
166 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
167 }
168
169 /**
170 * File references
171 */
172
173 /**
174 * @test
175 * @see DataSets/createContentWFileReference.csv
176 */
177 public function createContentWithFileReference() {
178 parent::createContentWithFileReference();
179 $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
180 $this->assertAssertionDataSet('createContentWFileReference');
181
182 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
183 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
184 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
185 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
186 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentImage)
187 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Image #1')->setStrict(TRUE));
188 }
189
190 /**
191 * @test
192 * @see DataSets/modifyContentWFileReference.csv
193 */
194 public function modifyContentWithFileReference() {
195 parent::modifyContentWithFileReference();
196 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
197 $this->assertAssertionDataSet('modifyContentWFileReference');
198
199 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
200 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
201 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
202 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
203 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
204 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'Image #1')->setStrict(TRUE));
205 }
206
207 /**
208 * @test
209 * @see DataSets/modifyContentNAddFileReference.csv
210 */
211 public function modifyContentAndAddFileReference() {
212 parent::modifyContentAndAddFileReference();
213 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
214 $this->assertAssertionDataSet('modifyContentNAddFileReference');
215
216 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
217 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
218 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
219 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper', 'Image #3')->setStrict(TRUE));
220 }
221
222 /**
223 * @test
224 * @see DataSets/modifyContentNDeleteFileReference.csv
225 */
226 public function modifyContentAndDeleteFileReference() {
227 parent::modifyContentAndDeleteFileReference();
228 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
229 $this->assertAssertionDataSet('modifyContentNDeleteFileReference');
230
231 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
232 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
233 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
234 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper')->setStrict(TRUE));
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'));
238 }
239
240 /**
241 * @test
242 * @see DataSets/modifyContentNDeleteAllFileReference.csv
243 */
244 public function modifyContentAndDeleteAllFileReference() {
245 parent::modifyContentAndDeleteAllFileReference();
246 $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
247 $this->assertAssertionDataSet('modifyContentNDeleteAllFileReference');
248
249 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
250 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
251 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
252 ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper'));
253 }
254
255 }