TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
core/Tests/Functional/DataHandling/ManyToMany/Modify/ActionTest.php
Go to the documentation of this file.
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 
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 
188  public function localizeContentOfRelation()
189  {
190  parent::localizeContentOfRelation();
191  $this->assertAssertionDataSet('localizeContentOfRelation');
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 
203  public function localizeCategoryOfRelation()
204  {
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 
219  {
220  parent::moveContentOfRelationToDifferentPage();
221  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
222 
223  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
224  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
225  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
226  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
227  }
228 
233  public function copyPage()
234  {
235  parent::copyPage();
236  $this->assertAssertionDataSet('copyPage');
237 
238  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
239  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
240  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
241  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
242  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
243  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
244  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
245  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
246  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
247  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
248  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
249  }
250 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)