‪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;
31 
32  const ‪TABLE_Content = 'tt_content';
33  const ‪TABLE_Element = 'tx_testdatahandler_element';
34 
35  const ‪FIELD_ContentElement = 'tx_testdatahandler_group';
36 
40  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Group/DataSet/';
41 
42  protected function ‪setUp()
43  {
44  $this->testExtensionsToLoad[] = 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler';
45 
46  parent::setUp();
47  $this->‪importScenarioDataSet('LiveDefaultPages');
48  $this->‪importScenarioDataSet('LiveDefaultElements');
49  $this->‪importScenarioDataSet('ReferenceIndex');
50 
51  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
52  }
53 
61  public function ‪addElementRelation()
62  {
63  $this->actionService->modifyReferences(
64  self::TABLE_Content,
65  self::VALUE_ContentIdFirst,
66  self::FIELD_ContentElement,
67  [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond, self::VALUE_ElementIdThird]
68  );
69  }
70 
74  public function ‪deleteElementRelation()
75  {
76  $this->actionService->modifyReferences(
77  self::TABLE_Content,
78  self::VALUE_ContentIdFirst,
79  self::FIELD_ContentElement,
80  [self::VALUE_ElementIdFirst]
81  );
82  }
83 
87  public function ‪changeElementSorting()
88  {
89  $this->actionService->moveRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, -self::VALUE_ElementIdSecond);
90  }
91 
95  public function ‪changeElementRelationSorting()
96  {
97  $this->actionService->modifyReferences(
98  self::TABLE_Content,
99  self::VALUE_ContentIdFirst,
100  self::FIELD_ContentElement,
101  [self::VALUE_ElementIdSecond, self::VALUE_ElementIdFirst]
102  );
103  }
104 
108  public function ‪createContentAndAddElementRelation()
109  {
110  $newTableIds = $this->actionService->createNewRecord(
111  self::TABLE_Content,
112  self::VALUE_PageId,
113  ['header' => 'Testing #1', self::FIELD_ContentElement => self::VALUE_ElementIdFirst]
114  );
115  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
116  }
117 
122  {
123  $newElementIds = $this->actionService->createNewRecord(self::TABLE_Element, self::VALUE_PageId, ['title' => 'Testing #1']);
124  $this->recordIds['newElementId'] = $newElementIds[‪self::TABLE_Element][0];
125  // It's not possible to use "NEW..." values for the TCA type 'group'
126  $newContentIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1', self::FIELD_ContentElement => $this->recordIds['newElementId']]);
127  $this->recordIds['newContentId'] = $newContentIds[‪self::TABLE_Content][0];
128  }
129 
133  public function ‪modifyElementOfRelation()
134  {
135  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
136  }
137 
141  public function ‪modifyContentOfRelation()
142  {
143  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
144  }
145 
149  public function ‪modifyBothSidesOfRelation()
150  {
151  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
152  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
153  }
154 
158  public function ‪deleteContentOfRelation()
159  {
160  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
161  }
162 
166  public function ‪deleteElementOfRelation()
167  {
168  $this->actionService->deleteRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
169  }
170 
174  public function ‪copyContentOfRelation()
175  {
176  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
177  $this->recordIds['copiedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
178  }
179 
183  public function ‪copyElementOfRelation()
184  {
185  $newTableIds = $this->actionService->copyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_PageId);
186  $this->recordIds['copiedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
187  }
188 
192  public function ‪copyContentToLanguageOfRelation()
193  {
194  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
195  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
196  }
197 
201  public function ‪copyElementToLanguageOfRelation()
202  {
203  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
204  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
205  }
206 
210  public function ‪localizeContentOfRelation()
211  {
212  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
213  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
214  }
215 
217  {
218  ‪$GLOBALS['TCA']['tt_content']['columns'][‪self::FIELD_ContentElement]['config']['behaviour']['allowLanguageSynchronization'] = true;
219  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
220  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
221  $this->actionService->modifyReferences(
222  self::TABLE_Content,
223  self::VALUE_ContentIdLast,
224  self::FIELD_ContentElement,
225  [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond]
226  );
227  }
228 
230  {
231  ‪$GLOBALS['TCA']['tt_content']['columns'][‪self::FIELD_ContentElement]['config']['behaviour']['allowLanguageSynchronization'] = true;
232  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
233  $this->recordIds['localizedContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
234  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['localizedContentIdFirst'], self::VALUE_LanguageIdSecond);
235  $this->recordIds['localizedContentIdSecond'] = $newTableIds[‪self::TABLE_Content][$this->recordIds['localizedContentIdFirst']];
236  $this->actionService->modifyRecord(
237  self::TABLE_Content,
238  $this->recordIds['localizedContentIdSecond'],
239  ['l10n_state' => [self::FIELD_ContentElement => 'source']]
240  );
241  $this->actionService->modifyReferences(
242  self::TABLE_Content,
243  self::VALUE_ContentIdLast,
244  self::FIELD_ContentElement,
245  [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond]
246  );
247  }
248 
252  public function ‪localizeElementOfRelation()
253  {
254  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
255  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
256  }
257 
262  {
263  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
264  }
265 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\copyElementToLanguageOfRelation
‪copyElementToLanguageOfRelation()
Definition: AbstractActionTestCase.php:200
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\localizeContentChainOfRelationWithLanguageSynchronizationSource
‪localizeContentChainOfRelationWithLanguageSynchronizationSource()
Definition: AbstractActionTestCase.php:228
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\FIELD_ContentElement
‪const FIELD_ContentElement
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\moveContentOfRelationToDifferentPage
‪moveContentOfRelationToDifferentPage()
Definition: AbstractActionTestCase.php:260
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group
Definition: AbstractActionTestCase.php:2
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\modifyBothSidesOfRelation
‪modifyBothSidesOfRelation()
Definition: AbstractActionTestCase.php:148
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\changeElementSorting
‪changeElementSorting()
Definition: AbstractActionTestCase.php:86
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\localizeContentOfRelationWithLanguageSynchronization
‪localizeContentOfRelationWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:215
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\TABLE_Element
‪const TABLE_Element
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\deleteElementOfRelation
‪deleteElementOfRelation()
Definition: AbstractActionTestCase.php:165
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:22
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ElementIdSecond
‪const VALUE_ElementIdSecond
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ElementIdThird
‪const VALUE_ElementIdThird
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\copyContentToLanguageOfRelation
‪copyContentToLanguageOfRelation()
Definition: AbstractActionTestCase.php:191
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\copyElementOfRelation
‪copyElementOfRelation()
Definition: AbstractActionTestCase.php:182
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\addElementRelation
‪addElementRelation()
Definition: AbstractActionTestCase.php:60
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\deleteElementRelation
‪deleteElementRelation()
Definition: AbstractActionTestCase.php:73
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\createContentAndAddElementRelation
‪createContentAndAddElementRelation()
Definition: AbstractActionTestCase.php:107
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ElementIdFirst
‪const VALUE_ElementIdFirst
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\modifyContentOfRelation
‪modifyContentOfRelation()
Definition: AbstractActionTestCase.php:140
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\localizeContentOfRelation
‪localizeContentOfRelation()
Definition: AbstractActionTestCase.php:209
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\deleteContentOfRelation
‪deleteContentOfRelation()
Definition: AbstractActionTestCase.php:157
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\modifyElementOfRelation
‪modifyElementOfRelation()
Definition: AbstractActionTestCase.php:132
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase
Definition: AbstractActionTestCase.php:21
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\copyContentOfRelation
‪copyContentOfRelation()
Definition: AbstractActionTestCase.php:173
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: AbstractActionTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\createContentAndCreateElementRelation
‪createContentAndCreateElementRelation()
Definition: AbstractActionTestCase.php:120
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:23
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\changeElementRelationSorting
‪changeElementRelationSorting()
Definition: AbstractActionTestCase.php:94
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_LanguageIdSecond
‪const VALUE_LanguageIdSecond
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\localizeElementOfRelation
‪localizeElementOfRelation()
Definition: AbstractActionTestCase.php:251
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:117