‪TYPO3CMS  ‪main
AbstractActionWorkspacesTestCase.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 {
22  protected const ‪VALUE_WorkspaceId = 1;
23 
24  protected const ‪SCENARIO_DataSet = __DIR__ . '/DataSet/ImportDefaultWorkspaces.csv';
25 
26  protected array ‪$coreExtensionsToLoad = ['workspaces'];
27 
29  {
30  ‪$GLOBALS['TCA']['tx_testirrecsv_offer']['ctrl']['versioningWS'] = false;
31  $this->actionService->moveRecord(self::TABLE_Hotel, self::VALUE_HotelIdFirst, -self::VALUE_HotelIdSecond);
32  }
33 
35  {
36  $newTableIds = $this->actionService->createNewRecords(
37  self::VALUE_PageId,
38  [
39  self::TABLE_Content => ['header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'],
40  self::TABLE_Hotel => ['title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'],
41  self::TABLE_Offer => ['title' => 'Offer #1'],
42  ]
43  );
44  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
45  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
46  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['newContentId']];
47  $versionedLocalizedContentId = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, $this->recordIds['localizedContentId']);
48  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $versionedLocalizedContentId);
49  }
50 
52  {
53  $this->actionService->modifyRecords(
54  self::VALUE_PageId,
55  [
56  self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, 'header' => 'Testing #1', self::FIELD_ContentHotel => '3,4'],
57  self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #1'],
58  ]
59  );
60  $this->recordIds['versionedContentId'] = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Content, self::VALUE_ContentIdFirst);
61  $this->recordIds['versionedHotelIdFirst'] = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Hotel, 3);
62  $this->recordIds['versionedHotelIdSecond'] = $this->actionService->getDataHandler()->getAutoVersionId(self::TABLE_Hotel, 4);
63  $this->actionService->clearWorkspaceRecords(
64  [
65  self::TABLE_Content => [$this->recordIds['versionedContentId']],
66  ]
67  );
68  $this->actionService->modifyRecords(
69  self::VALUE_PageId,
70  [
71  self::TABLE_Content => ['uid' => self::VALUE_ContentIdFirst, 'header' => 'Testing #2', self::FIELD_ContentHotel => '3,4'],
72  self::TABLE_Hotel => ['uid' => 4, 'title' => 'Testing #2'],
73  ]
74  );
75  }
76 
78  {
79  unset(‪$GLOBALS['TCA'][self::TABLE_Content]['ctrl']['delete']);
80  unset(‪$GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['delete']);
81  unset(‪$GLOBALS['TCA'][self::TABLE_Offer]['ctrl']['delete']);
82  unset(‪$GLOBALS['TCA'][self::TABLE_Price]['ctrl']['delete']);
83  $newRecordIds = $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
84  $this->actionService->clearWorkspaceRecord(self::TABLE_Content, $newRecordIds[self::TABLE_Content][self::VALUE_ContentIdLast]);
85  }
86 }
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv
Definition: AbstractActionTestCase.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionWorkspacesTestCase\createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent
‪createAndLocalizeParentContentWithHotelAndOfferChildrenAndDiscardLocalizedParent()
Definition: AbstractActionWorkspacesTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionWorkspacesTestCase\$coreExtensionsToLoad
‪array $coreExtensionsToLoad
Definition: AbstractActionWorkspacesTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionWorkspacesTestCase
Definition: AbstractActionWorkspacesTestCase.php:21
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionWorkspacesTestCase\modifyAndDiscardAndModifyParentWithHotelChild
‪modifyAndDiscardAndModifyParentWithHotelChild()
Definition: AbstractActionWorkspacesTestCase.php:51
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionWorkspacesTestCase\moveParentContentToDifferentPageAndDiscardWithoutSoftDelete
‪moveParentContentToDifferentPageAndDiscardWithoutSoftDelete()
Definition: AbstractActionWorkspacesTestCase.php:77
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionWorkspacesTestCase\SCENARIO_DataSet
‪const SCENARIO_DataSet
Definition: AbstractActionWorkspacesTestCase.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionTestCase
Definition: AbstractActionTestCase.php:24
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionWorkspacesTestCase\changeHotelSortingWithOfferNotWorkspaceAware
‪changeHotelSortingWithOfferNotWorkspaceAware()
Definition: AbstractActionWorkspacesTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreCsv\AbstractActionWorkspacesTestCase\VALUE_WorkspaceId
‪const VALUE_WorkspaceId
Definition: AbstractActionWorkspacesTestCase.php:22