‪TYPO3CMS  11.5
AbstractActionTestCase.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
26 {
27  protected const ‪VALUE_PageId = 89;
28  protected const ‪VALUE_PageIdTarget = 90;
29  protected const ‪VALUE_ContentIdFirst = 297;
30  protected const ‪VALUE_ContentIdLast = 298;
31  protected const ‪VALUE_LanguageId = 1;
32  protected const ‪VALUE_ElementIdFirst = 1;
33  protected const ‪VALUE_ElementIdSecond = 2;
34  protected const ‪VALUE_ElementIdThird = 3;
35 
36  protected const ‪TABLE_Content = 'tt_content';
37  protected const ‪TABLE_Element = 'tx_testdatahandler_element';
38 
39  protected const ‪FIELD_ContentElement = 'tx_testdatahandler_select';
40 
41  protected const ‪SCENARIO_DataSet = __DIR__ . '/DataSet/ImportDefault.csv';
42 
44  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial',
45  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler',
46  ];
47 
48  protected function ‪setUp(): void
49  {
50  parent::setUp();
51  $this->importCSVDataSet(static::SCENARIO_DataSet);
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(): void
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(): void
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(): void
78  {
79  $this->actionService->moveRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, -self::VALUE_ElementIdSecond);
80  }
81 
82  public function ‪changeElementRelationSorting(): void
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 
92  public function ‪createContentAndAddElementRelation(): void
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 'select' in a workspace, in live it would have been fine
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(): void
112  {
113  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
114  }
115 
116  public function ‪modifyContentOfRelation(): void
117  {
118  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
119  }
120 
121  public function ‪modifyBothSidesOfRelation(): void
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(): void
128  {
129  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
130  }
131 
132  public function ‪deleteElementOfRelation(): void
133  {
134  $this->actionService->deleteRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
135  }
136 
137  public function ‪copyContentOfRelation(): void
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(): void
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(): void
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(): void
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(): void
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 
173  public function ‪localizeElementOfRelation(): void
174  {
175  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
176  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
177  }
178 
180  {
181  ‪$GLOBALS['TCA']['tt_content']['columns'][‪self::FIELD_ContentElement]['config']['localizeReferencesAtParentLocalization'] = true;
182  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
183  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
184  }
185 
187  {
188  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
189  }
190 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select
Definition: AbstractActionTestCase.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\moveContentOfRelationToDifferentPage
‪moveContentOfRelationToDifferentPage()
Definition: AbstractActionTestCase.php:186
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteElementOfRelation
‪deleteElementOfRelation()
Definition: AbstractActionTestCase.php:132
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:127
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyContentOfRelation
‪copyContentOfRelation()
Definition: AbstractActionTestCase.php:137
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdSecond
‪const VALUE_ElementIdSecond
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:48
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteElementRelation
‪deleteElementRelation()
Definition: AbstractActionTestCase.php:67
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\SCENARIO_DataSet
‪const SCENARIO_DataSet
Definition: AbstractActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyContentToLanguageOfRelation
‪copyContentToLanguageOfRelation()
Definition: AbstractActionTestCase.php:152
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteContentOfRelation
‪deleteContentOfRelation()
Definition: AbstractActionTestCase.php:127
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\addElementRelation
‪addElementRelation()
Definition: AbstractActionTestCase.php:57
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\changeElementRelationSorting
‪changeElementRelationSorting()
Definition: AbstractActionTestCase.php:82
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\FIELD_ContentElement
‪const FIELD_ContentElement
Definition: AbstractActionTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\TABLE_Element
‪const TABLE_Element
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdFirst
‪const VALUE_ElementIdFirst
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\$testExtensionsToLoad
‪$testExtensionsToLoad
Definition: AbstractActionTestCase.php:43
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\localizeElementOfRelation
‪localizeElementOfRelation()
Definition: AbstractActionTestCase.php:173
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyContentOfRelation
‪modifyContentOfRelation()
Definition: AbstractActionTestCase.php:116
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyElementToLanguageOfRelation
‪copyElementToLanguageOfRelation()
Definition: AbstractActionTestCase.php:161
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyElementOfRelation
‪copyElementOfRelation()
Definition: AbstractActionTestCase.php:143
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyBothSidesOfRelation
‪modifyBothSidesOfRelation()
Definition: AbstractActionTestCase.php:121
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\localizeContentOfRelation
‪localizeContentOfRelation()
Definition: AbstractActionTestCase.php:167
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\localizeContentOfRelationWithLocalizeReferencesAtParentLocalization
‪localizeContentOfRelationWithLocalizeReferencesAtParentLocalization()
Definition: AbstractActionTestCase.php:179
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\createContentAndAddElementRelation
‪createContentAndAddElementRelation()
Definition: AbstractActionTestCase.php:92
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyElementOfRelation
‪modifyElementOfRelation()
Definition: AbstractActionTestCase.php:111
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\changeElementSorting
‪changeElementSorting()
Definition: AbstractActionTestCase.php:77
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\createContentAndCreateElementRelation
‪createContentAndCreateElementRelation()
Definition: AbstractActionTestCase.php:102
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdThird
‪const VALUE_ElementIdThird
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:31
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:29