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/FAL/PublishAll/DataSet/';
28 
37  public function modifyContent() {
38  parent::modifyContent();
39  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
40  $this->assertAssertionDataSet('modifyContent');
41 
42  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
43  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
44  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
45  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
46  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
47  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
48  }
49 
54  public function deleteContent() {
55  parent::deleteContent();
56  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
57  $this->assertAssertionDataSet('deleteContent');
58 
59  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
60  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
61  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
62  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
63  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
64  }
65 
70  public function copyContent() {
71  parent::copyContent();
72  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
73  $this->assertAssertionDataSet('copyContent');
74 
75  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
76  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
77  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
78  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
79  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentImage)
80  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
81  }
82 
87  public function localizeContent() {
88  parent::localizeContent();
89  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
90  $this->assertAssertionDataSet('localizeContent');
91 
92  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
93  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
94  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
95 
96  // @todo Values in sys_file_reference are not copied during localization...
97  /*
98  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
99  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
100  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
101  */
102  }
103 
108  public function changeContentSorting() {
109  parent::changeContentSorting();
110  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
111  $this->assertAssertionDataSet('changeContentSorting');
112 
113  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
114  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
115  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
116  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
117  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
118  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD'));
119  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
120  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
121  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
122  }
123 
128  public function moveContentToDifferentPage() {
129  parent::moveContentToDifferentPage();
130  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
131  $this->assertAssertionDataSet('moveContentToDifferentPage');
132 
133  $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
134  $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
135  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
136  $this->assertThat($responseSectionsSource, $this->getRequestSectionStructureHasRecordConstraint()
137  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
138  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(TRUE));
139  $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
140  $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
141  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
142  $this->assertThat($responseSectionsTarget, $this->getRequestSectionStructureHasRecordConstraint()
143  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
144  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
145  }
146 
152  parent::moveContentToDifferentPageAndChangeSorting();
153  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
154  $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
155 
156  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
157  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
158  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
159  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
160  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
161  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(TRUE));
162  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
163  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
164  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
165  }
166 
175  public function createContentWithFileReference() {
176  parent::createContentWithFileReference();
177  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
178  $this->assertAssertionDataSet('createContentWFileReference');
179 
180  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
181  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
182  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
183  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
184  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentImage)
185  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Image #1')->setStrict(TRUE));
186  }
187 
192  public function modifyContentWithFileReference() {
193  parent::modifyContentWithFileReference();
194  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
195  $this->assertAssertionDataSet('modifyContentWFileReference');
196 
197  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
198  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
199  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
200  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
201  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
202  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'Image #1')->setStrict(TRUE));
203  }
204 
210  parent::modifyContentAndAddFileReference();
211  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
212  $this->assertAssertionDataSet('modifyContentNAddFileReference');
213 
214  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
215  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
216  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
217  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper', 'Image #3')->setStrict(TRUE));
218  }
219 
225  parent::modifyContentAndDeleteFileReference();
226  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
227  $this->assertAssertionDataSet('modifyContentNDeleteFileReference');
228 
229  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
230  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
231  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
232  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper')->setStrict(TRUE));
233  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
234  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
235  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD'));
236  }
237 
243  parent::modifyContentAndDeleteAllFileReference();
244  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
245  $this->assertAssertionDataSet('modifyContentNDeleteAllFileReference');
246 
247  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
248  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
249  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
250  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper'));
251  }
252 
253 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=TRUE)