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