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