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/PublishAll/DataSet/';
26 
35  public function addCategoryRelation()
36  {
37  parent::addCategoryRelation();
38  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
39  $this->assertAssertionDataSet('addCategoryRelation');
40 
41  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
42  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
43  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
44  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category A.A'));
45  }
46 
51  public function deleteCategoryRelation()
52  {
53  parent::deleteCategoryRelation();
54  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
55  $this->assertAssertionDataSet('deleteCategoryRelation');
56 
57  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
58  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
59  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
60  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
61  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
62  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
63  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C', 'Category A.A'));
64  }
65 
71  {
72  parent::changeCategoryRelationSorting();
73  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
74  $this->assertAssertionDataSet('changeCategoryRelationSorting');
75 
76  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
77  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
78  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
79  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
80  }
81 
86  public function createContentAndAddRelation()
87  {
88  parent::createContentAndAddRelation();
89  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
90  $this->assertAssertionDataSet('createContentNAddRelation');
91 
92  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
93  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
94  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
95  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
96  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
97  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B'));
98  }
99 
105  {
106  parent::createCategoryAndAddRelation();
107  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
108  $this->assertAssertionDataSet('createCategoryNAddRelation');
109 
110  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
111  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
112  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
113  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
114  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
115  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
116  }
117 
123  {
124  parent::createContentAndCreateRelation();
125  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
126  $this->assertAssertionDataSet('createContentNCreateRelation');
127 
128  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
129  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
130  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
131  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
132  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
133  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
134  }
135 
141  {
142  parent::createCategoryAndCreateRelation();
143  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
144  $this->assertAssertionDataSet('createCategoryNCreateRelation');
145  }
146 
152  {
153  parent::createContentWithCategoryAndAddRelation();
154  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
155  $this->assertAssertionDataSet('createContentWCategoryNAddRelation');
156  }
157 
163  {
164  parent::createCategoryWithContentAndAddRelation();
165  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
166  $this->assertAssertionDataSet('createCategoryWContentNAddRelation');
167  }
168 
173  public function modifyCategoryOfRelation()
174  {
175  parent::modifyCategoryOfRelation();
176  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
177  $this->assertAssertionDataSet('modifyCategoryOfRelation');
178 
179  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
180  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
181  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
182  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
183  }
184 
189  public function modifyContentOfRelation()
190  {
191  parent::modifyContentOfRelation();
192  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
193  $this->assertAssertionDataSet('modifyContentOfRelation');
194 
195  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
196  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
197  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
198  }
199 
204  public function modifyBothsOfRelation()
205  {
206  parent::modifyBothsOfRelation();
207  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
208  $this->assertAssertionDataSet('modifyBothsOfRelation');
209 
210  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
211  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
212  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
213  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
214  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
215  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
216  }
217 
222  public function deleteContentOfRelation()
223  {
224  parent::deleteContentOfRelation();
225  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
226  $this->assertAssertionDataSet('deleteContentOfRelation');
227 
228  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
229  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
230  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
231  }
232 
237  public function deleteCategoryOfRelation()
238  {
239  parent::deleteCategoryOfRelation();
240  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
241  $this->assertAssertionDataSet('deleteCategoryOfRelation');
242 
243  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
244  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
245  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
246  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
247  }
248 
253  public function copyContentOfRelation()
254  {
255  parent::copyContentOfRelation();
256  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
257  $this->assertAssertionDataSet('copyContentOfRelation');
258 
259  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
260  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
261  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
262  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
263  }
264 
269  public function copyCategoryOfRelation()
270  {
271  parent::copyCategoryOfRelation();
272  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
273  $this->assertAssertionDataSet('copyCategoryOfRelation');
274 
275  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
276  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
277  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
278  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
279  }
280 
285  public function localizeContentOfRelation()
286  {
287  parent::localizeContentOfRelation();
288  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
289  $this->assertAssertionDataSet('localizeContentOfRelation');
290 
291  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
292  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
293  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
294  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
295  }
296 
301  public function localizeCategoryOfRelation()
302  {
303  parent::localizeCategoryOfRelation();
304  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
305  $this->assertAssertionDataSet('localizeCategoryOfRelation');
306 
307  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
308  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
309  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
310  ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
311  }
312 
318  {
319  parent::moveContentOfRelationToDifferentPage();
320  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
321  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
322 
323  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
324  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
325  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
326  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
327  }
328 
333  public function copyPage()
334  {
335  parent::copyPage();
336  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
337  $this->assertAssertionDataSet('copyPage');
338 
339  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
340  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
341  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
342  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
343  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
344  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
345  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
346  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
347  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
348  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
349  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
350  }
351 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)