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