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/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/';
28 
37  public function createContents() {
38  parent::createContents();
39  $this->assertAssertionDataSet('createContents');
40 
41  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
42  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
43  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', 'Testing #2'));
44  }
45 
50  public function modifyContent() {
51  parent::modifyContent();
52  $this->assertAssertionDataSet('modifyContent');
53 
54  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
55  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
56  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
57  }
58 
63  public function deleteContent() {
64  parent::deleteContent();
65  $this->assertAssertionDataSet('deleteContent');
66 
67  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
68  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
69  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
70  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
71  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
72  }
73 
79  parent::deleteLocalizedContentAndDeleteContent();
80  $this->assertAssertionDataSet('deleteLocalizedContentNDeleteContent');
81 
82  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
83  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
84  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #3', '[Translate to Dansk:] Regular Element #3'));
85  }
86 
91  public function copyContent() {
92  parent::copyContent();
93  $this->assertAssertionDataSet('copyContent');
94 
95  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
96  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
97  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
98  }
99 
104  public function copyPasteContent() {
105  parent::copyPasteContent();
106  $this->assertAssertionDataSet('copyPasteContent');
107 
108  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
109  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
110  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
111  }
112 
117  public function localizeContent() {
118  parent::localizeContent();
119  $this->assertAssertionDataSet('localizeContent');
120 
121  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
122  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
123  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
124  }
125 
130  public function changeContentSorting() {
131  parent::changeContentSorting();
132  $this->assertAssertionDataSet('changeContentSorting');
133 
134  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
135  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
136  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
137  }
138 
143  public function moveContentToDifferentPage() {
144  parent::moveContentToDifferentPage();
145  $this->assertAssertionDataSet('moveContentToDifferentPage');
146 
147  $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
148  $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
149  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
150  $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
151  $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
152  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
153  }
154 
160  parent::movePasteContentToDifferentPage();
161  $this->assertAssertionDataSet('movePasteContentToDifferentPage');
162 
163  $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
164  $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
165  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
166  $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
167  $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
168  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
169  }
170 
176  parent::moveContentToDifferentPageAndChangeSorting();
177  $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
178 
179  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
180  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
181  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
182  }
183 
192  public function createPage() {
193  parent::createPage();
194  $this->assertAssertionDataSet('createPage');
195 
196  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
197  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
198  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
199  }
200 
205  public function modifyPage() {
206  parent::modifyPage();
207  $this->assertAssertionDataSet('modifyPage');
208 
209  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
210  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
211  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
212  }
213 
218  public function deletePage() {
219  parent::deletePage();
220  $this->assertAssertionDataSet('deletePage');
221 
222  $response = $this->getFrontendResponse(self::VALUE_PageId, 0, 0, 0, FALSE);
223  $this->assertContains('PageNotFoundException', $response->getError());
224  }
225 
230  public function copyPage() {
231  parent::copyPage();
232  $this->assertAssertionDataSet('copyPage');
233 
234  $responseSections = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseSections();
235  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
236  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
237  }
238 
243  public function localizePage() {
244  parent::localizePage();
245  $this->assertAssertionDataSet('localizePage');
246 
247  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
248  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
249  ->setTable(self::TABLE_Page)->setField('title')->setValues('[Translate to Dansk:] Relations'));
250  }
251 
256  public function changePageSorting() {
257  parent::changePageSorting();
258  $this->assertAssertionDataSet('changePageSorting');
259 
260  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
261  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
262  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
263  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
264  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
265  }
266 
271  public function movePageToDifferentPage() {
272  parent::movePageToDifferentPage();
273  $this->assertAssertionDataSet('movePageToDifferentPage');
274 
275  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
276  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
277  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
278  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
279  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
280  }
281 
287  parent::movePageToDifferentPageAndChangeSorting();
288  $this->assertAssertionDataSet('movePageToDifferentPageNChangeSorting');
289 
290  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
291  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
292  ->setTable(self::TABLE_Page)->setField('title')->setValues('Relations'));
293  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
294  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
295  }
296 
297 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=TRUE)