TYPO3  7.6
ManyToMany/PublishAll/ActionTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\PublishAll;
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 
151  public function modifyCategoryOfRelation()
152  {
153  parent::modifyCategoryOfRelation();
154  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
155  $this->assertAssertionDataSet('modifyCategoryOfRelation');
156 
157  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
158  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
159  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
160  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
161  }
162 
167  public function modifyContentOfRelation()
168  {
169  parent::modifyContentOfRelation();
170  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
171  $this->assertAssertionDataSet('modifyContentOfRelation');
172 
173  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
174  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
175  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
176  }
177 
182  public function modifyBothsOfRelation()
183  {
184  parent::modifyBothsOfRelation();
185  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
186  $this->assertAssertionDataSet('modifyBothsOfRelation');
187 
188  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
189  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
190  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
191  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
192  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
193  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
194  }
195 
200  public function deleteContentOfRelation()
201  {
202  parent::deleteContentOfRelation();
203  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
204  $this->assertAssertionDataSet('deleteContentOfRelation');
205 
206  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
207  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
208  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
209  }
210 
215  public function deleteCategoryOfRelation()
216  {
217  parent::deleteCategoryOfRelation();
218  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
219  $this->assertAssertionDataSet('deleteCategoryOfRelation');
220 
221  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
222  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
223  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
224  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
225  }
226 
231  public function copyContentOfRelation()
232  {
233  parent::copyContentOfRelation();
234  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
235  $this->assertAssertionDataSet('copyContentOfRelation');
236 
237  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
238  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
239  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
240  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
241  }
242 
247  public function copyCategoryOfRelation()
248  {
249  parent::copyCategoryOfRelation();
250  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
251  $this->assertAssertionDataSet('copyCategoryOfRelation');
252 
253  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
254  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
255  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
256  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
257  }
258 
263  public function localizeContentOfRelation()
264  {
265  parent::localizeContentOfRelation();
266  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
267  $this->assertAssertionDataSet('localizeContentOfRelation');
268 
269  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
270  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
271  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
272  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
273  }
274 
279  public function localizeCategoryOfRelation()
280  {
281  parent::localizeCategoryOfRelation();
282  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
283  $this->assertAssertionDataSet('localizeCategoryOfRelation');
284 
285  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
286  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
287  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
288  ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
289  }
290 
296  {
297  parent::moveContentOfRelationToDifferentPage();
298  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
299  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
300 
301  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
302  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
303  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
304  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
305  }
306 
311  public function copyPage()
312  {
313  parent::copyPage();
314  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
315  $this->assertAssertionDataSet('copyPage');
316 
317  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
318  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
319  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
320  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
321  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
322  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
323  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
324  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
325  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
326  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
327  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
328  }
329 }