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/ManyToMany/PublishAll/DataSet/';
28 
37  public function addCategoryRelation() {
38  parent::addCategoryRelation();
39  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
40  $this->assertAssertionDataSet('addCategoryRelation');
41 
42  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
43  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
44  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
45  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category A.A'));
46  }
47 
52  public function deleteCategoryRelation() {
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 
70  public function changeCategoryRelationSorting() {
71  parent::changeCategoryRelationSorting();
72  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
73  $this->assertAssertionDataSet('changeCategoryRelationSorting');
74 
75  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
76  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
77  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
78  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
79  }
80 
85  public function createContentAndAddRelation() {
86  parent::createContentAndAddRelation();
87  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
88  $this->assertAssertionDataSet('createContentNAddRelation');
89 
90  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
91  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
92  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
93  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
94  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
95  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B'));
96  }
97 
102  public function createCategoryAndAddRelation() {
103  parent::createCategoryAndAddRelation();
104  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
105  $this->assertAssertionDataSet('createCategoryNAddRelation');
106 
107  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
108  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
109  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
110  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
111  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
112  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
113  }
114 
119  public function createContentAndCreateRelation() {
120  parent::createContentAndCreateRelation();
121  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
122  $this->assertAssertionDataSet('createContentNCreateRelation');
123 
124  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
125  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
126  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
127  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
128  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
129  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1'));
130  }
131 
137  parent::createCategoryAndCreateRelation();
138  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
139  $this->assertAssertionDataSet('createCategoryNCreateRelation');
140  }
141 
146  public function modifyCategoryOfRelation() {
147  parent::modifyCategoryOfRelation();
148  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
149  $this->assertAssertionDataSet('modifyCategoryOfRelation');
150 
151  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
152  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
153  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
154  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
155  }
156 
161  public function modifyContentOfRelation() {
162  parent::modifyContentOfRelation();
163  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
164  $this->assertAssertionDataSet('modifyContentOfRelation');
165 
166  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
167  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
168  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
169  }
170 
175  public function modifyBothsOfRelation() {
176  parent::modifyBothsOfRelation();
177  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
178  $this->assertAssertionDataSet('modifyBothsOfRelation');
179 
180  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
181  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
182  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
183  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1', 'Category B'));
184  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
185  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
186  }
187 
192  public function deleteContentOfRelation() {
193  parent::deleteContentOfRelation();
194  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
195  $this->assertAssertionDataSet('deleteContentOfRelation');
196 
197  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
198  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
199  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
200  }
201 
206  public function deleteCategoryOfRelation() {
207  parent::deleteCategoryOfRelation();
208  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
209  $this->assertAssertionDataSet('deleteCategoryOfRelation');
210 
211  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
212  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
213  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
214  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A'));
215  }
216 
221  public function copyContentOfRelation() {
222  parent::copyContentOfRelation();
223  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
224  $this->assertAssertionDataSet('copyContentOfRelation');
225 
226  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
227  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
228  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField('categories')
229  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
230  }
231 
236  public function copyCategoryOfRelation() {
237  parent::copyCategoryOfRelation();
238  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
239  $this->assertAssertionDataSet('copyCategoryOfRelation');
240 
241  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0)->getResponseSections();
242  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
243  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
244  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category A (copy 1)'));
245  }
246 
251  public function localizeContentOfRelation() {
252  parent::localizeContentOfRelation();
253  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
254  $this->assertAssertionDataSet('localizeContentOfRelation');
255 
256  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
257  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
258  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
259  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
260  }
261 
266  public function localizeCategoryOfRelation() {
267  parent::localizeCategoryOfRelation();
268  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
269  $this->assertAssertionDataSet('localizeCategoryOfRelation');
270 
271  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
272  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
273  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField('categories')
274  ->setTable(self::TABLE_Category)->setField('title')->setValues('[Translate to Dansk:] Category A', 'Category B'));
275  }
276 
282  parent::moveContentOfRelationToDifferentPage();
283  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
284  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
285 
286  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget, 0)->getResponseSections();
287  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
288  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField('categories')
289  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
290  }
291 
296  public function copyPage() {
297  parent::copyPage();
298  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
299  $this->assertAssertionDataSet('copyPage');
300 
301  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
302  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
303  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
304  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
305  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
306  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
307  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'])->setRecordField('categories')
308  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B'));
309  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
310  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'])->setRecordField('categories')
311  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category C'));
312  }
313 
314 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=TRUE)