‪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_CategoryIdLast = 31;
23  protected const ‪VALUE_WorkspaceId = 1;
24 
25  protected const ‪SCENARIO_DataSet = __DIR__ . '/DataSet/ImportDefaultWorkspaces.csv';
26 
27  protected array ‪$coreExtensionsToLoad = ['workspaces'];
28 
29  public function ‪createContentAndAddRelation(): void
30  {
31  $newTableIds = $this->actionService->createNewRecord(
32  self::TABLE_Content,
33  self::VALUE_PageId,
34  ['header' => 'Testing #1', 'categories' => self::VALUE_CategoryIdSecond]
35  );
36  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
37  }
38 
39  public function ‪createCategoryAndAddRelation(): void
40  {
41  $newTableIds = $this->actionService->createNewRecord(
42  self::TABLE_Category,
43  0,
44  ['title' => 'Testing #1', 'items' => 'tt_content_' . self::VALUE_ContentIdFirst]
45  );
46  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
47  }
48 
49  public function ‪createContentAndCreateRelation(): void
50  {
51  $newTableIds = $this->actionService->createNewRecords(
52  self::VALUE_PageId,
53  [
54  self::TABLE_Category => ['pid' => 0, 'title' => 'Testing #1'],
55  self::TABLE_Content => ['header' => 'Testing #1', 'categories' => '__previousUid'],
56  ]
57  );
58  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
59  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
60  }
61 
62  public function ‪createCategoryAndCreateRelation(): void
63  {
64  $newTableIds = $this->actionService->createNewRecords(
65  self::VALUE_PageId,
66  [
67  self::TABLE_Content => ['header' => 'Testing #1'],
68  self::TABLE_Category => ['pid' => 0, 'title' => 'Testing #1', 'items' => 'tt_content___previousUid'],
69  ]
70  );
71  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
72  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
73  }
74 
76  {
77  $newTableIds = $this->actionService->createNewRecords(
78  self::VALUE_PageId,
79  [
80  self::TABLE_Category => ['pid' => 0, 'title' => 'Testing #1'],
81  self::TABLE_Content => ['header' => 'Testing #1'],
82  ]
83  );
84  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
85  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
86 
87  $this->actionService->modifyRecord(
88  self::TABLE_Content,
89  $this->recordIds['newContentId'],
90  ['categories' => $this->recordIds['newCategoryId']]
91  );
92  }
93 
95  {
96  $newTableIds = $this->actionService->createNewRecords(
97  self::VALUE_PageId,
98  [
99  self::TABLE_Content => ['header' => 'Testing #1'],
100  self::TABLE_Category => ['pid' => 0, 'title' => 'Testing #1', 'items' => 'tt_content___previousUid'],
101  ]
102  );
103  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][0];
104  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
105 
106  $this->actionService->modifyRecord(
107  self::TABLE_Category,
108  $this->recordIds['newCategoryId'],
109  ['items' => 'tt_content_' . $this->recordIds['newContentId']]
110  );
111  }
112 }
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\$coreExtensionsToLoad
‪array $coreExtensionsToLoad
Definition: AbstractActionWorkspacesTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\createCategoryAndCreateRelation
‪createCategoryAndCreateRelation()
Definition: AbstractActionWorkspacesTestCase.php:62
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionTestCase\TABLE_Category
‪const TABLE_Category
Definition: AbstractActionTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\SCENARIO_DataSet
‪const SCENARIO_DataSet
Definition: AbstractActionWorkspacesTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany
Definition: AbstractActionTestCase.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionTestCase
Definition: AbstractActionTestCase.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\VALUE_CategoryIdLast
‪const VALUE_CategoryIdLast
Definition: AbstractActionWorkspacesTestCase.php:22
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\createCategoryWithContentAndAddRelation
‪createCategoryWithContentAndAddRelation()
Definition: AbstractActionWorkspacesTestCase.php:94
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\createContentWithCategoryAndAddRelation
‪createContentWithCategoryAndAddRelation()
Definition: AbstractActionWorkspacesTestCase.php:75
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase
Definition: AbstractActionWorkspacesTestCase.php:21
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\createContentAndCreateRelation
‪createContentAndCreateRelation()
Definition: AbstractActionWorkspacesTestCase.php:49
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\VALUE_WorkspaceId
‪const VALUE_WorkspaceId
Definition: AbstractActionWorkspacesTestCase.php:23
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\createCategoryAndAddRelation
‪createCategoryAndAddRelation()
Definition: AbstractActionWorkspacesTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\ManyToMany\AbstractActionWorkspacesTestCase\createContentAndAddRelation
‪createContentAndAddRelation()
Definition: AbstractActionWorkspacesTestCase.php:29