453131d00faaef02a0229c3c47a2e42dfb8b8d11
[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 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
52 $this->assertResponseContentStructureHasRecords(
53 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
54 self::TABLE_Category, 'title', array('Category A', 'Category B', 'Category A.A')
55 );
56 }
57
58 /**
59 * @test
60 * @see DataSet/Assertion/deleteCategoryRelation.csv
61 */
62 public function deleteCategoryRelation() {
63 parent::deleteCategoryRelation();
64 $this->assertAssertionDataSet('deleteCategoryRelation');
65
66 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
67 $this->assertResponseContentStructureHasRecords(
68 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
69 self::TABLE_Category, 'title', array('Category A')
70 );
71 $this->assertResponseContentStructureDoesNotHaveRecords(
72 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
73 self::TABLE_Category, 'title', array('Category B', 'Category C', 'Category A.A')
74 );
75 }
76
77 /**
78 * @test
79 * @see DataSet/Assertion/changeCategoryRelationSorting.csv
80 */
81 public function changeCategoryRelationSorting() {
82 parent::changeCategoryRelationSorting();
83 $this->assertAssertionDataSet('changeCategoryRelationSorting');
84
85 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
86 $this->assertResponseContentStructureHasRecords(
87 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
88 self::TABLE_Category, 'title', array('Category A', 'Category B')
89 );
90 }
91
92 /**
93 * @test
94 * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
95 */
96 public function modifyCategoryOfRelation() {
97 parent::modifyCategoryOfRelation();
98 $this->assertAssertionDataSet('modifyCategoryOfRelation');
99
100 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
101 $this->assertResponseContentStructureHasRecords(
102 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
103 self::TABLE_Category, 'title', array('Testing #1', 'Category B')
104 );
105 }
106
107 /**
108 * @test
109 * @see DataSet/Assertion/modifyContentRecordOfCategoryRelation.csv
110 */
111 public function modifyContentOfRelation() {
112 parent::modifyContentOfRelation();
113 $this->assertAssertionDataSet('modifyContentOfRelation');
114
115 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
116 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', 'Testing #1');
117 }
118
119 /**
120 * @test
121 * @see DataSet/Assertion/modifyBothRecordsOfCategoryRelation.csv
122 */
123 public function modifyBothsOfRelation() {
124 parent::modifyBothsOfRelation();
125 $this->assertAssertionDataSet('modifyBothsOfRelation');
126
127 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
128 $this->assertResponseContentStructureHasRecords(
129 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
130 self::TABLE_Category, 'title', array('Testing #1', 'Category B')
131 );
132 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', 'Testing #1');
133 }
134
135 /**
136 * @test
137 * @see DataSet/Assertion/deleteContentRecordOfCategoryRelation.csv
138 */
139 public function deleteContentOfRelation() {
140 parent::deleteContentOfRelation();
141 $this->assertAssertionDataSet('deleteContentOfRelation');
142
143 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
144 $this->assertResponseContentDoesNotHaveRecords($responseContent, self::TABLE_Content, 'header', 'Testing #1');
145 }
146
147 /**
148 * @test
149 * @see DataSet/Assertion/deleteCategoryRecordOfCategoryRelation.csv
150 */
151 public function deleteCategoryOfRelation() {
152 parent::deleteCategoryOfRelation();
153 $this->assertAssertionDataSet('deleteCategoryOfRelation');
154
155 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
156 $this->assertResponseContentStructureDoesNotHaveRecords(
157 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
158 self::TABLE_Category, 'title', array('Category A')
159 );
160 }
161
162 /**
163 * @test
164 * @see DataSet/Assertion/copyContentRecordOfCategoryRelation.csv
165 */
166 public function copyContentOfRelation() {
167 parent::copyContentOfRelation();
168 $this->assertAssertionDataSet('copyContentOfRelation');
169
170 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
171 $this->assertResponseContentStructureHasRecords(
172 $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentId'], 'categories',
173 self::TABLE_Category, 'title', array('Category B', 'Category C')
174 );
175 }
176
177 /**
178 * @test
179 * @see DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
180 */
181 public function copyCategoryOfRelation() {
182 parent::copyCategoryOfRelation();
183 $this->assertAssertionDataSet('copyCategoryOfRelation');
184
185 $responseContent = $this->getFrontendResponse(self::VALUE_PageId)->getResponseContent();
186 $this->assertResponseContentStructureHasRecords(
187 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
188 self::TABLE_Category, 'title', array('Category A', 'Category A (copy 1)')
189 );
190 }
191
192 /**
193 * @test
194 * @see DataSet/Assertion/localizeContentRecordOfCategoryRelation.csv
195 */
196 public function localizeContentOfRelation() {
197 parent::localizeContentOfRelation();
198 $this->assertAssertionDataSet('localizeContentOfRelation');
199
200 $responseContent = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseContent();
201 $this->assertResponseContentStructureHasRecords(
202 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdLast, 'categories',
203 self::TABLE_Category, 'title', array('Category B', 'Category C')
204 );
205 }
206
207 /**
208 * @test
209 * @see DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
210 */
211 public function localizeCategoryOfRelation() {
212 parent::localizeCategoryOfRelation();
213 $this->assertAssertionDataSet('localizeCategoryOfRelation');
214
215 $responseContent = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseContent();
216 $this->assertResponseContentStructureHasRecords(
217 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdFirst, 'categories',
218 self::TABLE_Category, 'title', array('[Translate to Dansk:] Category A', 'Category B')
219 );
220 }
221
222 /**
223 * @test
224 * @see DataSet/Assertion/moveContentRecordOfCategoryRelationToDifferentPage.csv
225 */
226 public function moveContentOfRelationToDifferentPage() {
227 parent::moveContentOfRelationToDifferentPage();
228 $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
229
230 $responseContent = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseContent();
231 $this->assertResponseContentStructureHasRecords(
232 $responseContent, self::TABLE_Content . ':' . self::VALUE_ContentIdLast, 'categories',
233 self::TABLE_Category, 'title', array('Category B', 'Category C')
234 );
235 }
236
237 /**
238 * @test
239 * @see DataSet/Assertion/copyPage.csv
240 */
241 public function copyPage() {
242 parent::copyPage();
243 $this->assertAssertionDataSet('copyPage');
244
245 $responseContent = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseContent();
246 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
247 $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
248 $this->assertResponseContentStructureHasRecords(
249 $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'], 'categories',
250 self::TABLE_Category, 'title', array('Category A', 'Category B')
251 );
252 $this->assertResponseContentStructureHasRecords(
253 $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'], 'categories',
254 self::TABLE_Category, 'title', array('Category B', 'Category C')
255 );
256 }
257
258 }