‪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 
22 {
25 
29  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/';
30 
34  protected ‪$coreExtensionsToLoad = [
35  'fluid',
36  'workspaces',
37  ];
38 
39  protected function ‪setUp(): void
40  {
41  parent::setUp();
42  $this->‪importScenarioDataSet('ReferenceIndex');
43  $this->‪setWorkspaceId(self::VALUE_WorkspaceId);
44  }
45 
46  public function ‪createContentAndAddRelation()
47  {
48  $newTableIds = $this->actionService->createNewRecord(
49  self::TABLE_Content,
50  self::VALUE_PageId,
51  ['header' => 'Testing #1', 'categories' => self::VALUE_CategoryIdSecond]
52  );
53  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
54  }
55 
56  public function ‪createCategoryAndAddRelation()
57  {
58  $newTableIds = $this->actionService->createNewRecord(
59  self::TABLE_Category,
60  0,
61  ['title' => 'Testing #1', 'items' => 'tt_content_' . self::VALUE_ContentIdFirst]
62  );
63  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
64  }
65 
66  public function ‪createContentAndCreateRelation()
67  {
68  $newTableIds = $this->actionService->createNewRecords(
69  self::VALUE_PageId,
70  [
71  self::TABLE_Category => ['pid' => 0, 'title' => 'Testing #1'],
72  self::TABLE_Content => ['header' => 'Testing #1', 'categories' => '__previousUid'],
73  ]
74  );
75  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
76  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
77  }
78 
79  public function ‪createCategoryAndCreateRelation()
80  {
81  $newTableIds = $this->actionService->createNewRecords(
82  self::VALUE_PageId,
83  [
84  self::TABLE_Content => ['header' => 'Testing #1'],
85  self::TABLE_Category => ['pid' => 0, 'title' => 'Testing #1', 'items' => 'tt_content___previousUid'],
86  ]
87  );
88  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
89  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
90  }
91 
93  {
94  $newTableIds = $this->actionService->createNewRecords(
95  self::VALUE_PageId,
96  [
97  self::TABLE_Category => ['pid' => 0, 'title' => 'Testing #1'],
98  self::TABLE_Content => ['header' => 'Testing #1'],
99  ]
100  );
101  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
102  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
103 
104  $this->actionService->modifyRecord(
105  self::TABLE_Content,
106  $this->recordIds['newContentId'],
107  ['categories' => $this->recordIds['newCategoryId']]
108  );
109  }
110 
112  {
113  $newTableIds = $this->actionService->createNewRecords(
114  self::VALUE_PageId,
115  [
116  self::TABLE_Content => ['header' => 'Testing #1'],
117  self::TABLE_Category => ['pid' => 0, 'title' => 'Testing #1', 'items' => 'tt_content___previousUid'],
118  ]
119  );
120  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
121  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
122 
123  $this->actionService->modifyRecord(
124  self::TABLE_Category,
125  $this->recordIds['newCategoryId'],
126  ['items' => 'tt_content_' . $this->recordIds['newContentId']]
127  );
128  }
129 }
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdLast
‪const VALUE_CategoryIdLast
Definition: AbstractActionTestCase.php:23
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\createContentAndAddRelation
‪createContentAndAddRelation()
Definition: AbstractActionTestCase.php:44
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\createContentWithCategoryAndAddRelation
‪createContentWithCategoryAndAddRelation()
Definition: AbstractActionTestCase.php:90
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\createCategoryWithContentAndAddRelation
‪createCategoryWithContentAndAddRelation()
Definition: AbstractActionTestCase.php:109
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_WorkspaceId
‪const VALUE_WorkspaceId
Definition: AbstractActionTestCase.php:24
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setWorkspaceId
‪setWorkspaceId(int $workspaceId)
Definition: AbstractDataHandlerActionTestCase.php:182
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase
Definition: AbstractActionTestCase.php:22
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\createContentAndCreateRelation
‪createContentAndCreateRelation()
Definition: AbstractActionTestCase.php:64
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\createCategoryAndAddRelation
‪createCategoryAndAddRelation()
Definition: AbstractActionTestCase.php:54
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\$coreExtensionsToLoad
‪array $coreExtensionsToLoad
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_Category
‪const TABLE_Category
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\createCategoryAndCreateRelation
‪createCategoryAndCreateRelation()
Definition: AbstractActionTestCase.php:77
‪TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\ManyToMany
Definition: AbstractActionTestCase.php:16
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:201
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase
Definition: AbstractActionTestCase.php:24