TYPO3 CMS  TYPO3_7-6
ActionTest.php
Go to the documentation of this file.
1 <?php
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 
21 {
25  protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/';
26 
35  public function addCategoryRelation()
36  {
37  parent::addCategoryRelation();
38  $this->assertAssertionDataSet('addCategoryRelation');
39 
40  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
41  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
42  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
43  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category A.A'));
44  }
45 
50  public function deleteCategoryRelation()
51  {
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 
69  {
70  parent::changeCategoryRelationSorting();
71  $this->assertAssertionDataSet('changeCategoryRelationSorting');
72 
73  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
74  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
75  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
76  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
77  }
78 
83  public function modifyCategoryOfRelation()
84  {
85  parent::modifyCategoryOfRelation();
86  $this->assertAssertionDataSet('modifyCategoryOfRelation');
87 
88  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
89  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
90  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
91  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
92  }
93 
98  public function modifyContentOfRelation()
99  {
100  parent::modifyContentOfRelation();
101  $this->assertAssertionDataSet('modifyContentOfRelation');
102 
103  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
104  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
105  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
106  }
107 
112  public function modifyBothsOfRelation()
113  {
114  parent::modifyBothsOfRelation();
115  $this->assertAssertionDataSet('modifyBothsOfRelation');
116 
117  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
118  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
119  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
120  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
121  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
122  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
123  }
124 
129  public function deleteContentOfRelation()
130  {
131  parent::deleteContentOfRelation();
132  $this->assertAssertionDataSet('deleteContentOfRelation');
133 
134  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
135  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
136  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
137  }
138 
143  public function deleteCategoryOfRelation()
144  {
145  parent::deleteCategoryOfRelation();
146  $this->assertAssertionDataSet('deleteCategoryOfRelation');
147 
148  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
149  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
150  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
151  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
152  }
153 
158  public function copyContentOfRelation()
159  {
160  parent::copyContentOfRelation();
161  $this->assertAssertionDataSet('copyContentOfRelation');
162 
163  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
164  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
165  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
166  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
167  }
168 
173  public function copyCategoryOfRelation()
174  {
175  parent::copyCategoryOfRelation();
176  $this->assertAssertionDataSet('copyCategoryOfRelation');
177 
178  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
179  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
180  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
181  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
182  }
183 
189  {
190  parent::copyContentToLanguageOfRelation();
191  $this->assertAssertionDataSet('copyContentToLanguageOfRelation');
192 
193  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
194  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
195  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
196  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
197  }
198 
204  {
205  parent::copyCategoryToLanguageOfRelation();
206  $this->assertAssertionDataSet('copyCategoryToLanguageOfRelation');
207  //in this case the translated element is orphaned (no CE with relation to it, and it has no l10n_parent)
208  //so on frontend there is no change.
209  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
210  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
211  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
212  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
213  }
214 
219  public function localizeContentOfRelation()
220  {
221  parent::localizeContentOfRelation();
222  $this->assertAssertionDataSet('localizeContentOfRelation');
223 
224  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
225  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
226  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
227  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
228  }
229 
234  public function localizeCategoryOfRelation()
235  {
236  parent::localizeCategoryOfRelation();
237  $this->assertAssertionDataSet('localizeCategoryOfRelation');
238 
239  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
240  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
241  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
242  ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
243  }
244 
250  {
251  parent::moveContentOfRelationToDifferentPage();
252  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
253 
254  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
255  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
256  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
257  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
258  }
259 
264  public function copyPage()
265  {
266  parent::copyPage();
267  $this->assertAssertionDataSet('copyPage');
268 
269  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
270  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
271  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
272  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
273  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
274  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
275  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
276  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
277  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
278  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
279  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
280  }
281 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)