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/Group/PublishAll/DataSet/';
26 
35  public function addElementRelation()
36  {
37  parent::addElementRelation();
38  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
39  $this->assertAssertionDataSet('addElementRelation');
40 
41  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
42  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
43  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
44  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2', 'Element #3'));
45  }
46 
51  public function deleteElementRelation()
52  {
53  parent::deleteElementRelation();
54  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
55  $this->assertAssertionDataSet('deleteElementRelation');
56 
57  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
58  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
59  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
60  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
61  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
62  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
63  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
64  }
65 
70  public function changeElementSorting()
71  {
72  parent::changeElementSorting();
73  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
74  $this->assertAssertionDataSet('changeElementSorting');
75 
76  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
77  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
78  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
79  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
80  }
81 
86  public function changeElementRelationSorting()
87  {
88  parent::changeElementRelationSorting();
89  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
90  $this->assertAssertionDataSet('changeElementRelationSorting');
91 
92  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
93  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
94  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
95  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
96  }
97 
103  {
104  parent::createContentAndAddElementRelation();
105  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
106  $this->assertAssertionDataSet('createContentNAddRelation');
107 
108  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
109  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
110  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
111  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
112  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
113  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
114  }
115 
121  {
122  parent::createContentAndCreateElementRelation();
123  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
124  $this->assertAssertionDataSet('createContentNCreateRelation');
125 
126  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
127  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
128  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
129  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
130  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
131  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1'));
132  }
133 
138  public function modifyElementOfRelation()
139  {
140  parent::modifyElementOfRelation();
141  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
142  $this->assertAssertionDataSet('modifyElementOfRelation');
143 
144  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
145  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
146  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
147  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
148  }
149 
154  public function modifyContentOfRelation()
155  {
156  parent::modifyContentOfRelation();
157  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
158  $this->assertAssertionDataSet('modifyContentOfRelation');
159 
160  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
161  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
162  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
163  }
164 
169  public function modifyBothSidesOfRelation()
170  {
171  parent::modifyBothSidesOfRelation();
172  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
173  $this->assertAssertionDataSet('modifyBothSidesOfRelation');
174 
175  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
176  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
177  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
178  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
179  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
180  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
181  }
182 
187  public function deleteContentOfRelation()
188  {
189  parent::deleteContentOfRelation();
190  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
191  $this->assertAssertionDataSet('deleteContentOfRelation');
192 
193  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
194  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
195  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
196  }
197 
202  public function deleteElementOfRelation()
203  {
204  parent::deleteElementOfRelation();
205  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
206  $this->assertAssertionDataSet('deleteElementOfRelation');
207 
208  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
209  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
210  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
211  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
212  }
213 
218  public function copyContentOfRelation()
219  {
220  parent::copyContentOfRelation();
221  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
222  $this->assertAssertionDataSet('copyContentOfRelation');
223 
224  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
225  // Referenced elements are not copied with the "parent", which is expected and correct
226  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
227  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentElement)
228  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
229  }
230 
235  public function copyElementOfRelation()
236  {
237  parent::copyElementOfRelation();
238  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
239  $this->assertAssertionDataSet('copyElementOfRelation');
240 
241  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
242  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
243  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
244  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
245  // Referenced elements are not updated at the "parent", which is expected and correct
246  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
247  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
248  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1 (copy 1)'));
249  }
250 
255  public function localizeContentOfRelation()
256  {
257  parent::localizeContentOfRelation();
258  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
259  $this->assertAssertionDataSet('localizeContentOfRelation');
260 
261  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
262  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
263  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
264  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
265  }
266 
271  public function localizeElementOfRelation()
272  {
273  parent::localizeElementOfRelation();
274  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
275  $this->assertAssertionDataSet('localizeElementOfRelation');
276 
277  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
278  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
279  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
280  ->setTable(self::TABLE_Element)->setField('title')->setValues('[Translate to Dansk:] Element #1', 'Element #2'));
281  }
282 
288  {
289  parent::moveContentOfRelationToDifferentPage();
290  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
291  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
292 
293  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
294  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
295  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
296  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
297  }
298 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)