‪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;
33 
34  const ‪TABLE_Content = 'tt_content';
35  const ‪TABLE_Element = 'tx_testdatahandler_element';
36 
37  const ‪FIELD_ContentElement = 'tx_testdatahandler_select';
38 
42  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Select/DataSet/';
43 
44  protected function ‪setUp(): void
45  {
46  $this->testExtensionsToLoad[] = 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler';
47 
48  parent::setUp();
49  $this->‪importScenarioDataSet('LiveDefaultPages');
50  $this->‪importScenarioDataSet('LiveDefaultElements');
51 
52  $this->‪setUpFrontendSite(1, $this->siteLanguageConfiguration);
53  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
54  }
55 
56  public function ‪addElementRelation()
57  {
58  $this->actionService->modifyReferences(
59  self::TABLE_Content,
60  self::VALUE_ContentIdFirst,
61  self::FIELD_ContentElement,
62  [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond, self::VALUE_ElementIdThird]
63  );
64  }
65 
66  public function ‪deleteElementRelation()
67  {
68  $this->actionService->modifyReferences(
69  self::TABLE_Content,
70  self::VALUE_ContentIdFirst,
71  self::FIELD_ContentElement,
72  [self::VALUE_ElementIdFirst]
73  );
74  }
75 
76  public function ‪changeElementSorting()
77  {
78  $this->actionService->moveRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, -self::VALUE_ElementIdSecond);
79  }
80 
81  public function ‪changeElementRelationSorting()
82  {
83  $this->actionService->modifyReferences(
84  self::TABLE_Content,
85  self::VALUE_ContentIdFirst,
86  self::FIELD_ContentElement,
87  [self::VALUE_ElementIdSecond, self::VALUE_ElementIdFirst]
88  );
89  }
90 
92  {
93  $newTableIds = $this->actionService->createNewRecord(
94  self::TABLE_Content,
95  self::VALUE_PageId,
96  ['header' => 'Testing #1', self::FIELD_ContentElement => self::VALUE_ElementIdFirst]
97  );
98  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
99  }
100 
102  {
103  $newElementIds = $this->actionService->createNewRecord(self::TABLE_Element, self::VALUE_PageId, ['title' => 'Testing #1']);
104  $this->recordIds['newElementId'] = $newElementIds[‪self::TABLE_Element][0];
105  // It's not possible to use "NEW..." values for the TCA type 'select' in a workspace, in live it would have been fine
106  $newContentIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1', self::FIELD_ContentElement => $this->recordIds['newElementId']]);
107  $this->recordIds['newContentId'] = $newContentIds[‪self::TABLE_Content][0];
108  }
109 
110  public function ‪modifyElementOfRelation()
111  {
112  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
113  }
114 
115  public function ‪modifyContentOfRelation()
116  {
117  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
118  }
119 
120  public function ‪modifyBothSidesOfRelation()
121  {
122  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
123  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
124  }
125 
126  public function ‪deleteContentOfRelation()
127  {
128  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
129  }
130 
131  public function ‪deleteElementOfRelation()
132  {
133  $this->actionService->deleteRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
134  }
135 
136  public function ‪copyContentOfRelation()
137  {
138  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
139  $this->recordIds['copiedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
140  }
141 
142  public function ‪copyElementOfRelation()
143  {
144  $newTableIds = $this->actionService->copyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_PageId);
145  $this->recordIds['copiedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
146  }
147 
151  public function ‪copyContentToLanguageOfRelation()
152  {
153  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
154  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
155  }
156 
160  public function ‪copyElementToLanguageOfRelation()
161  {
162  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
163  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
164  }
165 
166  public function ‪localizeContentOfRelation()
167  {
168  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
169  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
170  }
171 
172  public function ‪localizeElementOfRelation()
173  {
174  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
175  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
176  }
177 
179  {
180  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
181  }
182 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select
Definition: AbstractActionTestCase.php:16
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\moveContentOfRelationToDifferentPage
‪moveContentOfRelationToDifferentPage()
Definition: AbstractActionTestCase.php:177
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteElementOfRelation
‪deleteElementOfRelation()
Definition: AbstractActionTestCase.php:130
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:143
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyContentOfRelation
‪copyContentOfRelation()
Definition: AbstractActionTestCase.php:135
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdSecond
‪const VALUE_ElementIdSecond
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:43
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteElementRelation
‪deleteElementRelation()
Definition: AbstractActionTestCase.php:65
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase
Definition: AbstractActionTestCase.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyContentToLanguageOfRelation
‪copyContentToLanguageOfRelation()
Definition: AbstractActionTestCase.php:150
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteContentOfRelation
‪deleteContentOfRelation()
Definition: AbstractActionTestCase.php:125
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\addElementRelation
‪addElementRelation()
Definition: AbstractActionTestCase.php:55
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\changeElementRelationSorting
‪changeElementRelationSorting()
Definition: AbstractActionTestCase.php:80
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\FIELD_ContentElement
‪const FIELD_ContentElement
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\TABLE_Element
‪const TABLE_Element
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdFirst
‪const VALUE_ElementIdFirst
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\localizeElementOfRelation
‪localizeElementOfRelation()
Definition: AbstractActionTestCase.php:171
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyContentOfRelation
‪modifyContentOfRelation()
Definition: AbstractActionTestCase.php:114
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyElementToLanguageOfRelation
‪copyElementToLanguageOfRelation()
Definition: AbstractActionTestCase.php:159
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyElementOfRelation
‪copyElementOfRelation()
Definition: AbstractActionTestCase.php:141
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyBothSidesOfRelation
‪modifyBothSidesOfRelation()
Definition: AbstractActionTestCase.php:119
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\localizeContentOfRelation
‪localizeContentOfRelation()
Definition: AbstractActionTestCase.php:165
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\createContentAndAddElementRelation
‪createContentAndAddElementRelation()
Definition: AbstractActionTestCase.php:90
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyElementOfRelation
‪modifyElementOfRelation()
Definition: AbstractActionTestCase.php:109
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\changeElementSorting
‪changeElementSorting()
Definition: AbstractActionTestCase.php:75
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\createContentAndCreateElementRelation
‪createContentAndCreateElementRelation()
Definition: AbstractActionTestCase.php:100
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdThird
‪const VALUE_ElementIdThird
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: AbstractActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:201