TYPO3 CMS  TYPO3_7-6
AbstractActionTestCase.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 {
22  const VALUE_PageId = 89;
23  const VALUE_PageIdTarget = 90;
25  const VALUE_ContentIdFirst = 297;
26  const VALUE_ContentIdSecond = 298;
27  const VALUE_ContentIdThird = 299;
29  const VALUE_LanguageId = 1;
31 
32  const TABLE_Page = 'pages';
33  const TABLE_Content = 'tt_content';
34 
38  protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Regular/DataSet/';
39 
40  protected function setUp()
41  {
42  parent::setUp();
43  $this->importScenarioDataSet('LiveDefaultPages');
44  $this->importScenarioDataSet('LiveDefaultElements');
45 
46  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts']);
47  $this->backendUser->workspace = 0;
48  }
49 
58  public function createContents()
59  {
60  // Creating record at the beginning of the page
61  $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1']);
62  // Creating record at the end of the page (after last one)
63  $this->actionService->createNewRecord(self::TABLE_Content, -self::VALUE_ContentIdSecond, ['header' => 'Testing #2']);
64  }
65 
70  public function modifyContent()
71  {
72  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, ['header' => 'Testing #1']);
73  }
74 
79  public function deleteContent()
80  {
81  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdSecond);
82  }
83 
88  {
89  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdThirdLocalized);
90  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdThird);
91  }
92 
97  public function copyContent()
98  {
99  $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageId);
100  }
101 
106  public function copyContentToLanguage()
107  {
108  $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
109  }
110 
118  {
119  $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdThirdLocalized, self::VALUE_LanguageIdSecond);
120  }
121 
126  public function copyPasteContent()
127  {
128  $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageId, ['header' => 'Testing #1']);
129  }
130 
135  public function localizeContent()
136  {
137  $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
138  }
139 
145  {
146  $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdThirdLocalized, self::VALUE_LanguageIdSecond);
147  }
148 
153  public function changeContentSorting()
154  {
155  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
156  }
157 
162  public function moveContentToDifferentPage()
163  {
164  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget);
165  }
166 
172  {
173  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget, ['header' => 'Testing #1']);
174  }
175 
181  {
182  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_PageIdTarget);
183  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
184  }
185 
194  public function createPage()
195  {
196  $newTableIds = $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1', 'hidden' => 0]);
197  $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][0];
198  }
199 
204  public function modifyPage()
205  {
206  $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, ['title' => 'Testing #1']);
207  }
208 
213  public function deletePage()
214  {
215  $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
216  }
217 
222  public function copyPage()
223  {
224  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
225  $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
226  }
227 
232  public function copyPageFreeMode()
233  {
234  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageIdTarget, self::VALUE_PageIdTarget);
235  $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageIdTarget];
236  }
237 
242  public function localizePage()
243  {
244  $this->actionService->localizeRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
245  }
246 
251  public function changePageSorting()
252  {
253  $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
254  }
255 
260  public function movePageToDifferentPage()
261  {
262  $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
263  }
264 
270  {
271  $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageIdTarget, self::VALUE_PageIdWebsite);
272  $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
273  }
274 }
setUpFrontendRootPage($pageId, array $typoScriptFiles=[])