‪TYPO3CMS  10.4
AbstractActionTestCase.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 
24 {
25  const ‪VALUE_PageId = 89;
34 
35  const ‪TABLE_Content = 'tt_content';
36  const ‪TABLE_Element = 'tx_testdatahandler_element';
37 
38  const ‪FIELD_ContentElement = 'tx_testdatahandler_group';
39 
43  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Group/DataSet/';
44 
45  protected function ‪setUp(): void
46  {
47  $this->testExtensionsToLoad[] = 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler';
48 
49  parent::setUp();
50  $this->‪importScenarioDataSet('LiveDefaultPages');
51  $this->‪importScenarioDataSet('LiveDefaultElements');
52 
53  $this->‪setUpFrontendSite(1, $this->siteLanguageConfiguration);
54  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
55  }
56 
57  public function ‪addElementRelation()
58  {
59  $this->actionService->modifyReferences(
60  self::TABLE_Content,
61  self::VALUE_ContentIdFirst,
62  self::FIELD_ContentElement,
63  [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond, self::VALUE_ElementIdThird]
64  );
65  }
66 
67  public function ‪deleteElementRelation()
68  {
69  $this->actionService->modifyReferences(
70  self::TABLE_Content,
71  self::VALUE_ContentIdFirst,
72  self::FIELD_ContentElement,
73  [self::VALUE_ElementIdFirst]
74  );
75  }
76 
77  public function ‪changeElementSorting()
78  {
79  $this->actionService->moveRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, -self::VALUE_ElementIdSecond);
80  }
81 
82  public function ‪changeElementRelationSorting()
83  {
84  $this->actionService->modifyReferences(
85  self::TABLE_Content,
86  self::VALUE_ContentIdFirst,
87  self::FIELD_ContentElement,
88  [self::VALUE_ElementIdSecond, self::VALUE_ElementIdFirst]
89  );
90  }
91 
93  {
94  $newTableIds = $this->actionService->createNewRecord(
95  self::TABLE_Content,
96  self::VALUE_PageId,
97  ['header' => 'Testing #1', self::FIELD_ContentElement => self::VALUE_ElementIdFirst]
98  );
99  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
100  }
101 
103  {
104  $newElementIds = $this->actionService->createNewRecord(self::TABLE_Element, self::VALUE_PageId, ['title' => 'Testing #1']);
105  $this->recordIds['newElementId'] = $newElementIds[‪self::TABLE_Element][0];
106  // It's not possible to use "NEW..." values for the TCA type 'group'
107  $newContentIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1', self::FIELD_ContentElement => $this->recordIds['newElementId']]);
108  $this->recordIds['newContentId'] = $newContentIds[‪self::TABLE_Content][0];
109  }
110 
111  public function ‪modifyElementOfRelation()
112  {
113  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
114  }
115 
116  public function ‪modifyContentOfRelation()
117  {
118  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
119  }
120 
121  public function ‪modifyBothSidesOfRelation()
122  {
123  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
124  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
125  }
126 
127  public function ‪deleteContentOfRelation()
128  {
129  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
130  }
131 
132  public function ‪deleteElementOfRelation()
133  {
134  $this->actionService->deleteRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
135  }
136 
137  public function ‪copyContentOfRelation()
138  {
139  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
140  $this->recordIds['copiedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
141  }
142 
143  public function ‪copyElementOfRelation()
144  {
145  $newTableIds = $this->actionService->copyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_PageId);
146  $this->recordIds['copiedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
147  }
148 
152  public function ‪copyContentToLanguageOfRelation()
153  {
154  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
155  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
156  }
157 
161  public function ‪copyElementToLanguageOfRelation()
162  {
163  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
164  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
165  }
166 
167  public function ‪localizeContentOfRelation()
168  {
169  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
170  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
171  }
172 
174  {
175  ‪$GLOBALS['TCA']['tt_content']['columns'][‪self::FIELD_ContentElement]['config']['behaviour']['allowLanguageSynchronization'] = true;
176  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
177  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
178  $this->actionService->modifyReferences(
179  self::TABLE_Content,
180  self::VALUE_ContentIdLast,
181  self::FIELD_ContentElement,
182  [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond]
183  );
184  }
185 
187  {
188  ‪$GLOBALS['TCA']['tt_content']['columns'][‪self::FIELD_ContentElement]['config']['behaviour']['allowLanguageSynchronization'] = true;
189  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
190  $this->recordIds['localizedContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
191  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['localizedContentIdFirst'], self::VALUE_LanguageIdSecond);
192  $this->recordIds['localizedContentIdSecond'] = $newTableIds[‪self::TABLE_Content][$this->recordIds['localizedContentIdFirst']];
193  $this->actionService->modifyRecord(
194  self::TABLE_Content,
195  $this->recordIds['localizedContentIdSecond'],
196  ['l10n_state' => [self::FIELD_ContentElement => 'source']]
197  );
198  $this->actionService->modifyReferences(
199  self::TABLE_Content,
200  self::VALUE_ContentIdLast,
201  self::FIELD_ContentElement,
202  [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond]
203  );
204  }
205 
206  public function ‪localizeElementOfRelation()
207  {
208  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
209  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
210  }
211 
213  {
214  $newTableIds = $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
215  $this->recordIds['movedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
216  }
217 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\copyElementToLanguageOfRelation
‪copyElementToLanguageOfRelation()
Definition: AbstractActionTestCase.php:160
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\localizeContentChainOfRelationWithLanguageSynchronizationSource
‪localizeContentChainOfRelationWithLanguageSynchronizationSource()
Definition: AbstractActionTestCase.php:185
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\FIELD_ContentElement
‪const FIELD_ContentElement
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\moveContentOfRelationToDifferentPage
‪moveContentOfRelationToDifferentPage()
Definition: AbstractActionTestCase.php:211
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group
Definition: AbstractActionTestCase.php:16
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:143
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\modifyBothSidesOfRelation
‪modifyBothSidesOfRelation()
Definition: AbstractActionTestCase.php:120
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\changeElementSorting
‪changeElementSorting()
Definition: AbstractActionTestCase.php:76
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\localizeContentOfRelationWithLanguageSynchronization
‪localizeContentOfRelationWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:172
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\TABLE_Element
‪const TABLE_Element
Definition: AbstractActionTestCase.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\deleteElementOfRelation
‪deleteElementOfRelation()
Definition: AbstractActionTestCase.php:131
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ElementIdSecond
‪const VALUE_ElementIdSecond
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ElementIdThird
‪const VALUE_ElementIdThird
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\copyContentToLanguageOfRelation
‪copyContentToLanguageOfRelation()
Definition: AbstractActionTestCase.php:151
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\copyElementOfRelation
‪copyElementOfRelation()
Definition: AbstractActionTestCase.php:142
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\addElementRelation
‪addElementRelation()
Definition: AbstractActionTestCase.php:56
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\deleteElementRelation
‪deleteElementRelation()
Definition: AbstractActionTestCase.php:66
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\createContentAndAddElementRelation
‪createContentAndAddElementRelation()
Definition: AbstractActionTestCase.php:91
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ElementIdFirst
‪const VALUE_ElementIdFirst
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\modifyContentOfRelation
‪modifyContentOfRelation()
Definition: AbstractActionTestCase.php:115
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\localizeContentOfRelation
‪localizeContentOfRelation()
Definition: AbstractActionTestCase.php:166
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\deleteContentOfRelation
‪deleteContentOfRelation()
Definition: AbstractActionTestCase.php:126
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\modifyElementOfRelation
‪modifyElementOfRelation()
Definition: AbstractActionTestCase.php:110
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase
Definition: AbstractActionTestCase.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:44
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\copyContentOfRelation
‪copyContentOfRelation()
Definition: AbstractActionTestCase.php:136
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: AbstractActionTestCase.php:42
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\createContentAndCreateElementRelation
‪createContentAndCreateElementRelation()
Definition: AbstractActionTestCase.php:101
‪$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:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\changeElementRelationSorting
‪changeElementRelationSorting()
Definition: AbstractActionTestCase.php:81
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\VALUE_LanguageIdSecond
‪const VALUE_LanguageIdSecond
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase\localizeElementOfRelation
‪localizeElementOfRelation()
Definition: AbstractActionTestCase.php:205
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:201