‪TYPO3CMS  9.5
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;
28  const ‪VALUE_FileIdLast = 21;
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('PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/sys_file_storage.xml');
56 
57  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
58  }
59 
67  public function ‪modifyContent()
68  {
69  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, ['header' => 'Testing #1']);
70  }
71 
75  public function ‪deleteContent()
76  {
77  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
78  }
79 
83  public function ‪copyContent()
84  {
85  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
86  $this->recordIds['copiedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
87  }
88 
92  public function ‪copyContentToLanguage()
93  {
94  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
95  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
96  }
97 
101  public function ‪localizeContent()
102  {
103  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
104  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
105  }
106 
110  public function ‪changeContentSorting()
111  {
112  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
113  }
114 
118  public function ‪moveContentToDifferentPage()
119  {
120  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
121  }
122 
127  {
128  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
129  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
130  }
131 
139  public function ‪createContentWithFileReference()
140  {
141  $newTableIds = $this->actionService->createNewRecords(
142  self::VALUE_PageId,
143  [
144  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentImage => '__nextUid'],
145  self::TABLE_FileReference => ['title' => 'Image #1', self::FIELD_FileReferenceImage => self::VALUE_FileIdFirst],
146  ]
147  );
148  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
149  }
150 
154  public function ‪modifyContentWithFileReference()
155  {
156  $this->actionService->modifyRecords(
157  self::VALUE_PageId,
158  [
159  self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, 'header' => 'Testing #1', self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileLast . ',' . self::VALUE_FileReferenceContentLastFileFirst],
160  self::TABLE_FileReference => ['uid' => self::VALUE_FileReferenceContentLastFileFirst, 'title' => 'Image #1'],
161  ]
162  );
163  }
164 
168  public function ‪modifyContentAndAddFileReference()
169  {
170  $this->actionService->modifyRecords(
171  self::VALUE_PageId,
172  [
173  self::TABLE_Content => ['uid' => self::VALUE_ContentIdLast, self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileLast . ',' . self::VALUE_FileReferenceContentLastFileFirst . ',__nextUid'],
174  self::TABLE_FileReference => ['uid' => '__NEW', 'title' => 'Image #3', self::FIELD_FileReferenceImage => self::VALUE_FileIdFirst],
175  ]
176  );
177  }
178 
183  {
184  $this->actionService->modifyRecord(
185  self::TABLE_Content,
186  self::VALUE_ContentIdLast,
187  [self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileFirst],
188  [self::TABLE_FileReference => [self::VALUE_FileReferenceContentLastFileLast]]
189  );
190  }
191 
196  {
197  $this->actionService->modifyRecord(
198  self::TABLE_Content,
199  self::VALUE_ContentIdLast,
200  [self::FIELD_ContentImage => ''],
201  [self::TABLE_FileReference => [self::VALUE_FileReferenceContentLastFileFirst, self::VALUE_FileReferenceContentLastFileLast]]
202  );
203  }
204 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase
Definition: AbstractActionTestCase.php:21
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\moveContentToDifferentPageAndChangeSorting
‪moveContentToDifferentPageAndChangeSorting()
Definition: AbstractActionTestCase.php:125
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\FIELD_ContentImage
‪const FIELD_ContentImage
Definition: AbstractActionTestCase.php:42
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_FileReferenceContentFirstFileLast
‪const VALUE_FileReferenceContentFirstFileLast
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_FileReferenceContentLastFileLast
‪const VALUE_FileReferenceContentLastFileLast
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\copyContentToLanguage
‪copyContentToLanguage()
Definition: AbstractActionTestCase.php:91
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\copyContent
‪copyContent()
Definition: AbstractActionTestCase.php:82
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL
Definition: AbstractActionTestCase.php:2
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\TABLE_File
‪const TABLE_File
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: AbstractActionTestCase.php:47
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\modifyContent
‪modifyContent()
Definition: AbstractActionTestCase.php:66
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_FileReferenceContentFirstFileFirst
‪const VALUE_FileReferenceContentFirstFileFirst
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_FileIdLast
‪const VALUE_FileIdLast
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\moveContentToDifferentPage
‪moveContentToDifferentPage()
Definition: AbstractActionTestCase.php:117
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\modifyContentAndDeleteFileReference
‪modifyContentAndDeleteFileReference()
Definition: AbstractActionTestCase.php:181
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_PageIdWebsite
‪const VALUE_PageIdWebsite
Definition: AbstractActionTestCase.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\deleteContent
‪deleteContent()
Definition: AbstractActionTestCase.php:74
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\localizeContent
‪localizeContent()
Definition: AbstractActionTestCase.php:100
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_FileIdFirst
‪const VALUE_FileIdFirst
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\modifyContentAndDeleteAllFileReference
‪modifyContentAndDeleteAllFileReference()
Definition: AbstractActionTestCase.php:194
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\createContentWithFileReference
‪createContentWithFileReference()
Definition: AbstractActionTestCase.php:138
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\TABLE_Page
‪const TABLE_Page
Definition: AbstractActionTestCase.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\modifyContentAndAddFileReference
‪modifyContentAndAddFileReference()
Definition: AbstractActionTestCase.php:167
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\FIELD_FileReferenceImage
‪const FIELD_FileReferenceImage
Definition: AbstractActionTestCase.php:43
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\modifyContentWithFileReference
‪modifyContentWithFileReference()
Definition: AbstractActionTestCase.php:153
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\changeContentSorting
‪changeContentSorting()
Definition: AbstractActionTestCase.php:109
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\TABLE_FileReference
‪const TABLE_FileReference
Definition: AbstractActionTestCase.php:40
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\TABLE_FileMetadata
‪const TABLE_FileMetadata
Definition: AbstractActionTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:22
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_FileReferenceContentLastFileFirst
‪const VALUE_FileReferenceContentLastFileFirst
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:23
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:117
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:49