[TASK] Restructure functional frontend tests
[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 * Copyright notice
6 *
7 * (c) 2014 Oliver Hader <oliver.hader@typo3.org>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 require_once dirname(dirname(__FILE__)) . '/AbstractActionTestCase.php';
28
29 /**
30 * Functional test for the DataHandler
31 */
32 class ActionTest extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase {
33
34 /**
35 * @var string
36 */
37 protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/';
38
39 /**
40 * MM Relations
41 */
42
43 /**
44 * @test
45 * @see DataSet/Assertion/addCategoryRelation.csv
46 */
47 public function addCategoryRelation() {
48 parent::addCategoryRelation();
49 $this->assertAssertionDataSet('addCategoryRelation');
50
51 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
52 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
53 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
54 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category A.A'));
55 }
56
57 /**
58 * @test
59 * @see DataSet/Assertion/deleteCategoryRelation.csv
60 */
61 public function deleteCategoryRelation() {
62 parent::deleteCategoryRelation();
63 $this->assertAssertionDataSet('deleteCategoryRelation');
64
65 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
66 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
67 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
68 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
69 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
70 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
71 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C', 'Category A.A'));
72 }
73
74 /**
75 * @test
76 * @see DataSet/Assertion/changeCategoryRelationSorting.csv
77 */
78 public function changeCategoryRelationSorting() {
79 parent::changeCategoryRelationSorting();
80 $this->assertAssertionDataSet('changeCategoryRelationSorting');
81
82 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
83 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
84 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
85 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
86 }
87
88 /**
89 * @test
90 * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
91 */
92 public function modifyCategoryOfRelation() {
93 parent::modifyCategoryOfRelation();
94 $this->assertAssertionDataSet('modifyCategoryOfRelation');
95
96 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
97 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
98 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
99 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
100 }
101
102 /**
103 * @test
104 * @see DataSet/Assertion/modifyContentRecordOfCategoryRelation.csv
105 */
106 public function modifyContentOfRelation() {
107 parent::modifyContentOfRelation();
108 $this->assertAssertionDataSet('modifyContentOfRelation');
109
110 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
111 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
112 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
113 }
114
115 /**
116 * @test
117 * @see DataSet/Assertion/modifyBothRecordsOfCategoryRelation.csv
118 */
119 public function modifyBothsOfRelation() {
120 parent::modifyBothsOfRelation();
121 $this->assertAssertionDataSet('modifyBothsOfRelation');
122
123 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
124 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
125 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
126 ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
127 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
128 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
129 }
130
131 /**
132 * @test
133 * @see DataSet/Assertion/deleteContentRecordOfCategoryRelation.csv
134 */
135 public function deleteContentOfRelation() {
136 parent::deleteContentOfRelation();
137 $this->assertAssertionDataSet('deleteContentOfRelation');
138
139 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
140 $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
141 ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
142 }
143
144 /**
145 * @test
146 * @see DataSet/Assertion/deleteCategoryRecordOfCategoryRelation.csv
147 */
148 public function deleteCategoryOfRelation() {
149 parent::deleteCategoryOfRelation();
150 $this->assertAssertionDataSet('deleteCategoryOfRelation');
151
152 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
153 $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
154 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
155 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
156 }
157
158 /**
159 * @test
160 * @see DataSet/Assertion/copyContentRecordOfCategoryRelation.csv
161 */
162 public function copyContentOfRelation() {
163 parent::copyContentOfRelation();
164 $this->assertAssertionDataSet('copyContentOfRelation');
165
166 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
167 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
168 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
169 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
170 }
171
172 /**
173 * @test
174 * @see DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
175 */
176 public function copyCategoryOfRelation() {
177 parent::copyCategoryOfRelation();
178 $this->assertAssertionDataSet('copyCategoryOfRelation');
179
180 $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
181 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
182 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
183 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
184 }
185
186 /**
187 * @test
188 * @see DataSet/Assertion/localizeContentRecordOfCategoryRelation.csv
189 */
190 public function localizeContentOfRelation() {
191 parent::localizeContentOfRelation();
192 $this->assertAssertionDataSet('localizeContentOfRelation');
193
194 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
195 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
196 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
197 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
198 }
199
200 /**
201 * @test
202 * @see DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
203 */
204 public function localizeCategoryOfRelation() {
205 parent::localizeCategoryOfRelation();
206 $this->assertAssertionDataSet('localizeCategoryOfRelation');
207
208 $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
209 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
210 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
211 ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
212 }
213
214 /**
215 * @test
216 * @see DataSet/Assertion/moveContentRecordOfCategoryRelationToDifferentPage.csv
217 */
218 public function moveContentOfRelationToDifferentPage() {
219 parent::moveContentOfRelationToDifferentPage();
220 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
221
222 $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
223 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
224 ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
225 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
226 }
227
228 /**
229 * @test
230 * @see DataSet/Assertion/copyPage.csv
231 */
232 public function copyPage() {
233 parent::copyPage();
234 $this->assertAssertionDataSet('copyPage');
235
236 $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
237 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
238 ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
239 $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
240 ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
241 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
242 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
243 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
244 $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
245 ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
246 ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
247 }
248
249 }