TYPO3 CMS  TYPO3_6-2
ActionTest.php
Go to the documentation of this file.
1 <?php
3 
17 require_once dirname(dirname(__FILE__)) . '/AbstractActionTestCase.php';
18 
23 
27  protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/Select/PublishAll/DataSet/';
28 
37  public function addElementRelation() {
38  parent::addElementRelation();
39  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
40  $this->assertAssertionDataSet('addElementRelation');
41 
42  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
43  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
44  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
45  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2', 'Element #3'));
46  }
47 
52  public function deleteElementRelation() {
53  parent::deleteElementRelation();
54  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
55  $this->assertAssertionDataSet('deleteElementRelation');
56 
57  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->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  parent::changeElementSorting();
72  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
73  $this->assertAssertionDataSet('changeElementSorting');
74 
75  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
76  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
77  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
78  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
79  }
80 
85  public function changeElementRelationSorting() {
86  parent::changeElementRelationSorting();
87  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
88  $this->assertAssertionDataSet('changeElementRelationSorting');
89 
90  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
91  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
92  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
93  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
94  }
95 
101  parent::createContentAndAddElementRelation();
102  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
103  $this->assertAssertionDataSet('createContentNAddRelation');
104 
105  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
106  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
107  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
108  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
109  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
110  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
111  }
112 
118  parent::createContentAndCreateElementRelation();
119  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
120  $this->assertAssertionDataSet('createContentNCreateRelation');
121 
122  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->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(self::FIELD_ContentElement)
127  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1'));
128  }
129 
134  public function modifyElementOfRelation() {
135  parent::modifyElementOfRelation();
136  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
137  $this->assertAssertionDataSet('modifyElementOfRelation');
138 
139  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
140  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
141  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
142  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
143  }
144 
149  public function modifyContentOfRelation() {
150  parent::modifyContentOfRelation();
151  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
152  $this->assertAssertionDataSet('modifyContentOfRelation');
153 
154  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
155  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
156  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
157  }
158 
163  public function modifyBothSidesOfRelation() {
164  parent::modifyBothSidesOfRelation();
165  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
166  $this->assertAssertionDataSet('modifyBothSidesOfRelation');
167 
168  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
169  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
170  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
171  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
172  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
173  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
174  }
175 
180  public function deleteContentOfRelation() {
181  parent::deleteContentOfRelation();
182  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
183  $this->assertAssertionDataSet('deleteContentOfRelation');
184 
185  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
186  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
187  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
188  }
189 
194  public function deleteElementOfRelation() {
195  parent::deleteElementOfRelation();
196  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
197  $this->assertAssertionDataSet('deleteElementOfRelation');
198 
199  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
200  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
201  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
202  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
203  }
204 
209  public function copyContentOfRelation() {
210  parent::copyContentOfRelation();
211  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
212  $this->assertAssertionDataSet('copyContentOfRelation');
213 
214  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
215  // Referenced elements are not copied with the "parent", which is expected and correct
216  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
217  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentElement)
218  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
219  }
220 
225  public function copyElementOfRelation() {
226  parent::copyElementOfRelation();
227  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
228  $this->assertAssertionDataSet('copyElementOfRelation');
229 
230  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
231  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
232  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
233  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
234  // Referenced elements are not updated at the "parent", which is expected and correct
235  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
236  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
237  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1 (copy 1)'));
238  }
239 
244  public function localizeContentOfRelation() {
245  parent::localizeContentOfRelation();
246  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
247  $this->assertAssertionDataSet('localizeContentOfRelation');
248 
249  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
250  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
251  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
252  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
253  }
254 
259  public function localizeElementOfRelation() {
260  parent::localizeElementOfRelation();
261  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
262  $this->assertAssertionDataSet('localizeElementOfRelation');
263 
264  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
265  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
266  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
267  ->setTable(self::TABLE_Element)->setField('title')->setValues('[Translate to Dansk:] Element #1', 'Element #2'));
268  }
269 
275  parent::moveContentOfRelationToDifferentPage();
276  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
277  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
278 
279  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
280  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
281  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
282  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
283  }
284 
285 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=TRUE)