‪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;
30 
31  const ‪TABLE_Content = 'tt_content';
32  const ‪TABLE_Element = 'tx_testdatahandler_element';
33 
34  const ‪FIELD_ContentElement = 'tx_testdatahandler_select';
35 
39  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Select/DataSet/';
40 
41  protected function ‪setUp()
42  {
43  $this->testExtensionsToLoad[] = 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler';
44 
45  parent::setUp();
46  $this->‪importScenarioDataSet('LiveDefaultPages');
47  $this->‪importScenarioDataSet('LiveDefaultElements');
48  $this->‪importScenarioDataSet('ReferenceIndex');
49 
50  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
51  }
52 
60  public function ‪addElementRelation()
61  {
62  $this->actionService->modifyReferences(
63  self::TABLE_Content,
64  self::VALUE_ContentIdFirst,
65  self::FIELD_ContentElement,
66  [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond, self::VALUE_ElementIdThird]
67  );
68  }
69 
73  public function ‪deleteElementRelation()
74  {
75  $this->actionService->modifyReferences(
76  self::TABLE_Content,
77  self::VALUE_ContentIdFirst,
78  self::FIELD_ContentElement,
79  [self::VALUE_ElementIdFirst]
80  );
81  }
82 
86  public function ‪changeElementSorting()
87  {
88  $this->actionService->moveRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, -self::VALUE_ElementIdSecond);
89  }
90 
94  public function ‪changeElementRelationSorting()
95  {
96  $this->actionService->modifyReferences(
97  self::TABLE_Content,
98  self::VALUE_ContentIdFirst,
99  self::FIELD_ContentElement,
100  [self::VALUE_ElementIdSecond, self::VALUE_ElementIdFirst]
101  );
102  }
103 
107  public function ‪createContentAndAddElementRelation()
108  {
109  $newTableIds = $this->actionService->createNewRecord(
110  self::TABLE_Content,
111  self::VALUE_PageId,
112  ['header' => 'Testing #1', self::FIELD_ContentElement => self::VALUE_ElementIdFirst]
113  );
114  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
115  }
116 
121  {
122  $newElementIds = $this->actionService->createNewRecord(self::TABLE_Element, self::VALUE_PageId, ['title' => 'Testing #1']);
123  $this->recordIds['newElementId'] = $newElementIds[‪self::TABLE_Element][0];
124  // It's not possible to use "NEW..." values for the TCA type 'select' in a workspace, in live it would have been fine
125  $newContentIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1', self::FIELD_ContentElement => $this->recordIds['newElementId']]);
126  $this->recordIds['newContentId'] = $newContentIds[‪self::TABLE_Content][0];
127  }
128 
132  public function ‪modifyElementOfRelation()
133  {
134  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
135  }
136 
140  public function ‪modifyContentOfRelation()
141  {
142  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
143  }
144 
148  public function ‪modifyBothSidesOfRelation()
149  {
150  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
151  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
152  }
153 
157  public function ‪deleteContentOfRelation()
158  {
159  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
160  }
161 
165  public function ‪deleteElementOfRelation()
166  {
167  $this->actionService->deleteRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
168  }
169 
173  public function ‪copyContentOfRelation()
174  {
175  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
176  $this->recordIds['copiedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
177  }
178 
182  public function ‪copyElementOfRelation()
183  {
184  $newTableIds = $this->actionService->copyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_PageId);
185  $this->recordIds['copiedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
186  }
187 
191  public function ‪copyContentToLanguageOfRelation()
192  {
193  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
194  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
195  }
196 
200  public function ‪copyElementToLanguageOfRelation()
201  {
202  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
203  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
204  }
205 
209  public function ‪localizeContentOfRelation()
210  {
211  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
212  $this->recordIds['localizedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
213  }
214 
218  public function ‪localizeElementOfRelation()
219  {
220  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
221  $this->recordIds['localizedElementId'] = $newTableIds[‪self::TABLE_Element][‪self::VALUE_ElementIdFirst];
222  }
223 
228  {
229  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
230  }
231 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select
Definition: AbstractActionTestCase.php:2
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\moveContentOfRelationToDifferentPage
‪moveContentOfRelationToDifferentPage()
Definition: AbstractActionTestCase.php:226
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteElementOfRelation
‪deleteElementOfRelation()
Definition: AbstractActionTestCase.php:164
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyContentOfRelation
‪copyContentOfRelation()
Definition: AbstractActionTestCase.php:172
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:23
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdSecond
‪const VALUE_ElementIdSecond
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:40
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteElementRelation
‪deleteElementRelation()
Definition: AbstractActionTestCase.php:72
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase
Definition: AbstractActionTestCase.php:21
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyContentToLanguageOfRelation
‪copyContentToLanguageOfRelation()
Definition: AbstractActionTestCase.php:190
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\deleteContentOfRelation
‪deleteContentOfRelation()
Definition: AbstractActionTestCase.php:156
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\addElementRelation
‪addElementRelation()
Definition: AbstractActionTestCase.php:59
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\changeElementRelationSorting
‪changeElementRelationSorting()
Definition: AbstractActionTestCase.php:93
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\FIELD_ContentElement
‪const FIELD_ContentElement
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\TABLE_Element
‪const TABLE_Element
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdFirst
‪const VALUE_ElementIdFirst
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:22
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\localizeElementOfRelation
‪localizeElementOfRelation()
Definition: AbstractActionTestCase.php:217
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyContentOfRelation
‪modifyContentOfRelation()
Definition: AbstractActionTestCase.php:139
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyElementToLanguageOfRelation
‪copyElementToLanguageOfRelation()
Definition: AbstractActionTestCase.php:199
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\copyElementOfRelation
‪copyElementOfRelation()
Definition: AbstractActionTestCase.php:181
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyBothSidesOfRelation
‪modifyBothSidesOfRelation()
Definition: AbstractActionTestCase.php:147
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\localizeContentOfRelation
‪localizeContentOfRelation()
Definition: AbstractActionTestCase.php:208
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\createContentAndAddElementRelation
‪createContentAndAddElementRelation()
Definition: AbstractActionTestCase.php:106
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\modifyElementOfRelation
‪modifyElementOfRelation()
Definition: AbstractActionTestCase.php:131
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\changeElementSorting
‪changeElementSorting()
Definition: AbstractActionTestCase.php:85
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\createContentAndCreateElementRelation
‪createContentAndCreateElementRelation()
Definition: AbstractActionTestCase.php:119
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ElementIdThird
‪const VALUE_ElementIdThird
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Select\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:117