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 = 330;
26  const VALUE_ContentIdLast = 331;
27  const VALUE_FileIdFirst = 1;
28  const VALUE_FileIdLast = 21;
29  const VALUE_LanguageId = 1;
30 
35 
36  const TABLE_Page = 'pages';
37  const TABLE_Content = 'tt_content';
38  const TABLE_File = 'sys_file';
39  const TABLE_FileMetadata = 'sys_file_metadata';
40  const TABLE_FileReference = 'sys_file_reference';
41 
42  const FIELD_ContentImage = 'image';
43  const FIELD_FileReferenceImage = 'uid_local';
44 
48  protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/FAL/DataSet/';
49 
50  protected function setUp()
51  {
52  parent::setUp();
53  $this->importScenarioDataSet('LiveDefaultPages');
54  $this->importScenarioDataSet('LiveDefaultElements');
55  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/sys_file_storage.xml');
56 
57  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts']);
58  $this->backendUser->workspace = 0;
59  }
60 
68  public function modifyContent()
69  {
70  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, ['header' => 'Testing #1']);
71  }
72 
76  public function deleteContent()
77  {
78  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
79  }
80 
84  public function copyContent()
85  {
86  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
87  $this->recordIds['copiedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
88  }
89 
93  public function copyContentToLanguage()
94  {
95  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
96  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
97  }
98 
102  public function localizeContent()
103  {
104  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
105  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
106  }
107 
111  public function changeContentSorting()
112  {
113  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
114  }
115 
119  public function moveContentToDifferentPage()
120  {
121  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
122  }
123 
128  {
129  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
130  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
131  }
132 
141  {
142  $newTableIds = $this->actionService->createNewRecords(
143  self::VALUE_PageId,
144  [
145  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentImage => '__nextUid'],
146  self::TABLE_FileReference => ['title' => 'Image #1', self::FIELD_FileReferenceImage => self::VALUE_FileIdFirst],
147  ]
148  );
149  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
150  }
151 
156  {
157  $this->actionService->modifyRecords(
158  self::VALUE_PageId,
159  [
160  self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, 'header' => 'Testing #1', self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileLast . ',' . self::VALUE_FileReferenceContentLastFileFirst],
161  self::TABLE_FileReference => ['uid' => self::VALUE_FileReferenceContentLastFileFirst, 'title' => 'Image #1'],
162  ]
163  );
164  }
165 
170  {
171  $this->actionService->modifyRecords(
172  self::VALUE_PageId,
173  [
174  self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileLast . ',' . self::VALUE_FileReferenceContentLastFileFirst . ',__nextUid'],
175  self::TABLE_FileReference => ['uid' => '__NEW', 'title' => 'Image #3', self::FIELD_FileReferenceImage => self::VALUE_FileIdFirst],
176  ]
177  );
178  }
179 
184  {
185  $this->actionService->modifyRecord(
186  self::TABLE_Content,
187  self::VALUE_ContentIdLast,
188  [self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileFirst],
189  [self::TABLE_FileReference => [self::VALUE_FileReferenceContentLastFileLast]]
190  );
191  }
192 
197  {
198  $this->actionService->modifyRecord(
199  self::TABLE_Content,
200  self::VALUE_ContentIdLast,
201  [self::FIELD_ContentImage => ''],
202  [self::TABLE_FileReference => [self::VALUE_FileReferenceContentLastFileFirst, self::VALUE_FileReferenceContentLastFileLast]]
203  );
204  }
205 }
setUpFrontendRootPage($pageId, array $typoScriptFiles=[])