‪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 {
23 
27  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/IRRE/CSV/DataSet/';
28 
32  protected ‪$coreExtensionsToLoad = [
33  'fluid',
34  'workspaces',
35  ];
36 
37  protected function ‪setUp()
38  {
39  parent::setUp();
40  $this->‪importScenarioDataSet('ReferenceIndex');
41  $this->‪setWorkspaceId(self::VALUE_WorkspaceId);
42  }
43 
52  {
53  $newTableIds = $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
54  $versionedDeletedContentId = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
55  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $versionedDeletedContentId);
56  }
57 
66  {
67  ‪$GLOBALS['TCA']['tx_irretutorial_1ncsv_offer']['ctrl']['versioningWS'] = false;
68  $this->actionService->moveRecord(self::TABLE_Hotel, self::VALUE_HotelIdFirst, -self::VALUE_HotelIdSecond);
69  }
70 
75  {
76  // @todo Copying the new child records is broken in the Core
77  $newTableIds = $this->actionService->createNewRecords(
78  self::VALUE_PageId,
79  [
80  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
81  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
82  self::TABLE_Offer => ['title' => 'Offer #1'],
83  ]
84  );
85  $this->recordIds['newContentId'] = $newTableIds['tt_content'][0];
86  $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
87  $this->recordIds['copiedContentId'] = $copiedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
88  $versionedCopiedContentId = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, $this->recordIds['copiedContentId']);
89  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $versionedCopiedContentId);
90  }
91 
96  {
97  $newTableIds = $this->actionService->createNewRecords(
98  self::VALUE_PageId,
99  [
100  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
101  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
102  self::TABLE_Offer => ['title' => 'Offer #1'],
103  ]
104  );
105  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
106  $this->recordIds['versionedNewContentId'] = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, $this->recordIds['newContentId']);
107  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
108  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
109  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $this->recordIds['versionedNewContentId']);
110  }
111 
116  {
117  // @todo Localizing the new child records is broken in the Core
118  $newTableIds = $this->actionService->createNewRecords(
119  self::VALUE_PageId,
120  [
121  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
122  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
123  self::TABLE_Offer => ['title' => 'Offer #1'],
124  ]
125  );
126  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
127  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
128  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
129  $versionedLocalizedContentId = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, $this->recordIds['localizedContentId']);
130  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $versionedLocalizedContentId);
131  }
132 
137  {
138  $this->actionService->modifyRecords(
139  self::VALUE_PageId,
140  [
141  self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'],
142  self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
143  ]
144  );
145  $modifiedContentId = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, self::VALUE_ContentIdFirst);
146  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $modifiedContentId);
147  }
148 
153  {
154  $this->actionService->modifyRecords(
155  self::VALUE_PageId,
156  [
157  self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'],
158  self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
159  ]
160  );
161  $modifiedContentId = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, self::VALUE_ContentIdFirst);
162  $modifiedHotelId = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Hotel, 4);
163  $this->actionService->clearWorkspaceRecords(
164  [
165  self::TABLE_Content => [$modifiedContentId],
166  self::TABLE_Hotel => [$modifiedHotelId],
167  ]
168  );
169  }
170 
175  {
176  $this->actionService->modifyRecords(
177  self::VALUE_PageId,
178  [
179  self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, 'header' => 'Testing #1', self::FIELD_ContentHotel => '3,4'],
180  self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
181  ]
182  );
183  $this->recordIds['versionedContentId'] = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, self::VALUE_ContentIdFirst);
184  $this->recordIds['versionedHotelIdFirst'] = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Hotel, 3);
185  $this->recordIds['versionedHotelIdSecond'] = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Hotel, 4);
186  $this->actionService->clearWorkspaceRecords(
187  [
188  self::TABLE_Content => [$this->recordIds['versionedContentId']],
189  self::TABLE_Hotel => [$this->recordIds['versionedHotelIdSecond']],
190  ]
191  );
192  $this->actionService->modifyRecords(
193  self::VALUE_PageId,
194  [
195  self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, 'header' => 'Testing #2', self::FIELD_ContentHotel => '3,4'],
196  self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #2'],
197  ]
198  );
199  }
200 }
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV
Definition: AbstractActionTestCase.php:2
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\modifyParentWithHotelChildAndDiscardModifiedParent
‪modifyParentWithHotelChildAndDiscardModifiedParent()
Definition: AbstractActionTestCase.php:134
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\deleteParentContentAndDiscardDeletedParent
‪deleteParentContentAndDiscardDeletedParent()
Definition: AbstractActionTestCase.php:49
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent
‪createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardCreatedParent()
Definition: AbstractActionTestCase.php:93
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\modifyParentWithHotelChildAndDiscardAll
‪modifyParentWithHotelChildAndDiscardAll()
Definition: AbstractActionTestCase.php:150
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\$coreExtensionsToLoad
‪array $coreExtensionsToLoad
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\changeHotelSortingWithOfferNotWorkspaceAware
‪changeHotelSortingWithOfferNotWorkspaceAware()
Definition: AbstractActionTestCase.php:63
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent
‪createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent()
Definition: AbstractActionTestCase.php:113
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setWorkspaceId
‪setWorkspaceId(int $workspaceId)
Definition: AbstractDataHandlerActionTestCase.php:98
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\modifyAndDiscardAndModifyParentWithHotelChild
‪modifyAndDiscardAndModifyParentWithHotelChild()
Definition: AbstractActionTestCase.php:172
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase
Definition: AbstractActionTestCase.php:21
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent
‪createAndCopyParentContentWithHotelAndOfferChildrenAndDiscardCopiedParent()
Definition: AbstractActionTestCase.php:72
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\VALUE_WorkspaceId
‪const VALUE_WorkspaceId
Definition: AbstractActionTestCase.php:22
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase
Definition: AbstractActionTestCase.php:21
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\IRRE\CSV\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:117