[TASK] Re-work/simplify copyright header in PHP files - Part 4
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / ManyToMany / Modify / ActionTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\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 require_once dirname(dirname(__FILE__)) . '/AbstractActionTestCase.php';
18
19 /**
20 * Functional test for the DataHandler
21 */
22 class ActionTest extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase {
23
24 /**
25 * @var string
26 */
27 protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/';
28
29 /**
30 * MM Relations
31 */
32
33 /**
34 * @test
35 * @see DataSet/Assertion/addCategoryRelation.csv
36 */
37 public function addCategoryRelation() {
38 parent::addCategoryRelation();
39 $this->assertAssertionDataSet('addCategoryRelation');
40
41 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
42 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
43 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
44 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category A.A'));
45 }
46
47 /**
48 * @test
49 * @see DataSet/Assertion/deleteCategoryRelation.csv
50 */
51 public function deleteCategoryRelation() {
52 parent::deleteCategoryRelation();
53 $this->assertAssertionDataSet('deleteCategoryRelation');
54
55 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
56 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
57 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
58 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
59 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
60 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
61 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C', 'Category A.A'));
62 }
63
64 /**
65 * @test
66 * @see DataSet/Assertion/changeCategoryRelationSorting.csv
67 */
68 public function changeCategoryRelationSorting() {
69 parent::changeCategoryRelationSorting();
70 $this->assertAssertionDataSet('changeCategoryRelationSorting');
71
72 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
73 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
74 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
75 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
76 }
77
78 /**
79 * @test
80 * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
81 */
82 public function modifyCategoryOfRelation() {
83 parent::modifyCategoryOfRelation();
84 $this->assertAssertionDataSet('modifyCategoryOfRelation');
85
86 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
87 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
88 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
89 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
90 }
91
92 /**
93 * @test
94 * @see DataSet/Assertion/modifyContentRecordOfCategoryRelation.csv
95 */
96 public function modifyContentOfRelation() {
97 parent::modifyContentOfRelation();
98 $this->assertAssertionDataSet('modifyContentOfRelation');
99
100 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
101 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
102 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
103 }
104
105 /**
106 * @test
107 * @see DataSet/Assertion/modifyBothRecordsOfCategoryRelation.csv
108 */
109 public function modifyBothsOfRelation() {
110 parent::modifyBothsOfRelation();
111 $this->assertAssertionDataSet('modifyBothsOfRelation');
112
113 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
114 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
115 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
116 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
117 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
118 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
119 }
120
121 /**
122 * @test
123 * @see DataSet/Assertion/deleteContentRecordOfCategoryRelation.csv
124 */
125 public function deleteContentOfRelation() {
126 parent::deleteContentOfRelation();
127 $this->assertAssertionDataSet('deleteContentOfRelation');
128
129 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
130 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
131 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
132 }
133
134 /**
135 * @test
136 * @see DataSet/Assertion/deleteCategoryRecordOfCategoryRelation.csv
137 */
138 public function deleteCategoryOfRelation() {
139 parent::deleteCategoryOfRelation();
140 $this->assertAssertionDataSet('deleteCategoryOfRelation');
141
142 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
143 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
144 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
145 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
146 }
147
148 /**
149 * @test
150 * @see DataSet/Assertion/copyContentRecordOfCategoryRelation.csv
151 */
152 public function copyContentOfRelation() {
153 parent::copyContentOfRelation();
154 $this->assertAssertionDataSet('copyContentOfRelation');
155
156 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
157 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
158 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
159 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
160 }
161
162 /**
163 * @test
164 * @see DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
165 */
166 public function copyCategoryOfRelation() {
167 parent::copyCategoryOfRelation();
168 $this->assertAssertionDataSet('copyCategoryOfRelation');
169
170 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
171 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
172 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
173 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
174 }
175
176 /**
177 * @test
178 * @see DataSet/Assertion/localizeContentRecordOfCategoryRelation.csv
179 */
180 public function localizeContentOfRelation() {
181 parent::localizeContentOfRelation();
182 $this->assertAssertionDataSet('localizeContentOfRelation');
183
184 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
185 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
186 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
187 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
188 }
189
190 /**
191 * @test
192 * @see DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
193 */
194 public function localizeCategoryOfRelation() {
195 parent::localizeCategoryOfRelation();
196 $this->assertAssertionDataSet('localizeCategoryOfRelation');
197
198 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
199 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
200 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
201 ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
202 }
203
204 /**
205 * @test
206 * @see DataSet/Assertion/moveContentRecordOfCategoryRelationToDifferentPage.csv
207 */
208 public function moveContentOfRelationToDifferentPage() {
209 parent::moveContentOfRelationToDifferentPage();
210 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
211
212 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
213 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
214 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
215 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
216 }
217
218 /**
219 * @test
220 * @see DataSet/Assertion/copyPage.csv
221 */
222 public function copyPage() {
223 parent::copyPage();
224 $this->assertAssertionDataSet('copyPage');
225
226 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
227 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
228 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
229 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
230 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
231 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
232 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
233 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
234 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
235 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
236 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
237 }
238
239 }