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/workspaces/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, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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 createContentAndAddRelation()
84  {
85  parent::createContentAndAddRelation();
86  $this->assertAssertionDataSet('createContentNAddRelation');
87 
88  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
89  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
90  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
91  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
92  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
93  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B'));
94  }
95 
101  {
102  parent::createCategoryAndAddRelation();
103  $this->assertAssertionDataSet('createCategoryNAddRelation');
104 
105  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
106  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
107  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
108  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
109  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
110  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
111  }
112 
118  {
119  parent::createContentAndCreateRelation();
120  $this->assertAssertionDataSet('createContentNCreateRelation');
121 
122  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
123  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
124  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
125  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
126  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
127  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
128  }
129 
135  {
136  parent::createCategoryAndCreateRelation();
137  $this->assertAssertionDataSet('createCategoryNCreateRelation');
138  }
139 
145  {
146  parent::createContentWithCategoryAndAddRelation();
147  $this->assertAssertionDataSet('createContentWCategoryNAddRelation');
148  }
149 
155  {
156  parent::createCategoryWithContentAndAddRelation();
157  $this->assertAssertionDataSet('createCategoryWContentNAddRelation');
158  }
159 
164  public function modifyCategoryOfRelation()
165  {
166  parent::modifyCategoryOfRelation();
167  $this->assertAssertionDataSet('modifyCategoryOfRelation');
168 
169  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
170  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
171  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
172  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
173  }
174 
179  public function modifyContentOfRelation()
180  {
181  parent::modifyContentOfRelation();
182  $this->assertAssertionDataSet('modifyContentOfRelation');
183 
184  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
185  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
186  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
187  }
188 
193  public function modifyBothsOfRelation()
194  {
195  parent::modifyBothsOfRelation();
196  $this->assertAssertionDataSet('modifyBothsOfRelation');
197 
198  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->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('Testing #1', 'Category B'));
202  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
203  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
204  }
205 
210  public function deleteContentOfRelation()
211  {
212  parent::deleteContentOfRelation();
213  $this->assertAssertionDataSet('deleteContentOfRelation');
214 
215  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
216  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
217  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
218  }
219 
224  public function deleteCategoryOfRelation()
225  {
226  parent::deleteCategoryOfRelation();
227  $this->assertAssertionDataSet('deleteCategoryOfRelation');
228 
229  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
230  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
231  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
232  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
233  }
234 
239  public function copyContentOfRelation()
240  {
241  parent::copyContentOfRelation();
242  $this->assertAssertionDataSet('copyContentOfRelation');
243 
244  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
245  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
246  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
247  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
248  }
249 
254  public function copyCategoryOfRelation()
255  {
256  parent::copyCategoryOfRelation();
257  $this->assertAssertionDataSet('copyCategoryOfRelation');
258 
259  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
260  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
261  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
262  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
263  }
264 
269  public function localizeContentOfRelation()
270  {
271  parent::localizeContentOfRelation();
272  $this->assertAssertionDataSet('localizeContentOfRelation');
273 
274  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
275  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
276  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
277  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
278  }
279 
284  public function localizeCategoryOfRelation()
285  {
286  parent::localizeCategoryOfRelation();
287  $this->assertAssertionDataSet('localizeCategoryOfRelation');
288 
289  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
290  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
291  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
292  ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
293  }
294 
300  {
301  parent::moveContentOfRelationToDifferentPage();
302  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
303 
304  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
305  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
306  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
307  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
308  }
309 
314  public function copyPage()
315  {
316  parent::copyPage();
317  $this->assertAssertionDataSet('copyPage');
318 
319  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'], 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
320  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
321  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
322  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
323  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
324  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
325  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
326  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
327  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
328  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
329  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
330  }
331 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)