‪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 
21 
26 {
27  protected const ‪VALUE_PageId = 88;
28  protected const ‪VALUE_TargetPageId = 89;
29  protected const ‪VALUE_CategoryPageId = 0;
30  protected const ‪VALUE_ContentIdFirst = 297;
31  protected const ‪VALUE_ContentIdLast = 298;
32  protected const ‪VALUE_CategoryIdFirst = 28;
33  protected const ‪VALUE_CategoryIdSecond = 29;
34  protected const ‪VALUE_CategoryIdThird = 30;
35  protected const ‪VALUE_CategoryIdFourth = 31;
36 
37  protected const ‪TABLE_Content = 'tt_content';
38  protected const ‪TABLE_Category = 'sys_category';
39 
40  protected const ‪FIELD_Categories = 'tx_testdatahandler_categories';
41 
42  protected const ‪SCENARIO_DataSet = __DIR__ . '/DataSet/ImportDefault.csv';
43 
45  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler',
46  ];
47 
48  protected function ‪setUp(): void
49  {
50  parent::setUp();
51  $this->importCSVDataSet(static::SCENARIO_DataSet);
52 
53  $this->‪setUpFrontendSite(1, $this->siteLanguageConfiguration);
54  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
55  }
56 
57  public function ‪addCategoryRelation(): void
58  {
59  $this->actionService->modifyReferences(
60  self::TABLE_Content,
61  self::VALUE_ContentIdLast,
62  self::FIELD_Categories,
63  [self::VALUE_CategoryIdThird]
64  );
65  }
66 
67  public function ‪addCategoryRelations(): void
68  {
69  $this->actionService->modifyReferences(
70  self::TABLE_Content,
71  self::VALUE_ContentIdLast,
72  self::FIELD_Categories,
73  [self::VALUE_CategoryIdThird, self::VALUE_CategoryIdFourth]
74  );
75  }
76 
77  public function ‪addCategoryRelationToExisting(): void
78  {
79  $this->actionService->modifyReferences(
80  self::TABLE_Content,
81  self::VALUE_ContentIdFirst,
82  self::FIELD_Categories,
83  [self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdThird]
84  );
85  }
86 
87  public function ‪addCategoryRelationsToExisting(): void
88  {
89  $this->actionService->modifyReferences(
90  self::TABLE_Content,
91  self::VALUE_ContentIdFirst,
92  self::FIELD_Categories,
93  [self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdThird, self::VALUE_CategoryIdFourth]
94  );
95  }
96 
97  public function ‪createAndAddCategoryRelation(): void
98  {
99  $newTableIds = $this->actionService->createNewRecord(
100  self::TABLE_Category,
101  self::VALUE_CategoryPageId,
102  [
103  'title' => 'Category B.A',
104  'parent' => self::VALUE_CategoryIdSecond,
105  ]
106  );
107 
108  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
109 
110  $this->actionService->modifyReferences(
111  self::TABLE_Content,
112  self::VALUE_ContentIdFirst,
113  self::FIELD_Categories,
114  [self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdSecond, $this->recordIds['newCategoryId']]
115  );
116 
117  $this->actionService->modifyReferences(
118  self::TABLE_Content,
119  self::VALUE_ContentIdLast,
120  self::FIELD_Categories,
121  [$this->recordIds['newCategoryId']]
122  );
123  }
124 
125  public function ‪createAndReplaceCategoryRelation(): void
126  {
127  $newTableIds = $this->actionService->createNewRecord(
128  self::TABLE_Category,
129  self::VALUE_CategoryPageId,
130  [
131  'title' => 'Category B.A',
132  'parent' => self::VALUE_CategoryIdSecond,
133  ]
134  );
135 
136  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
137 
138  $this->actionService->modifyReferences(
139  self::TABLE_Content,
140  self::VALUE_ContentIdFirst,
141  self::FIELD_Categories,
142  [$this->recordIds['newCategoryId']]
143  );
144  }
145 
147  {
148  $this->actionService->modifyReferences(
149  self::TABLE_Content,
150  self::VALUE_ContentIdFirst,
151  self::FIELD_Categories,
152  [self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdThird]
153  );
154  }
155 
156  public function ‪modifyReferencingContentElement(): void
157  {
158  $this->actionService->modifyRecord(
159  self::TABLE_Content,
160  self::VALUE_ContentIdFirst,
161  ['header' => 'Testing #1']
162  );
163  }
164 
165  public function ‪modifyContentOfRelatedCategory(): void
166  {
167  $this->actionService->modifyRecord(
168  self::TABLE_Category,
169  self::VALUE_CategoryIdSecond,
170  ['title' => 'Testing #1']
171  );
172  }
173 
175  {
176  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, self::VALUE_TargetPageId);
177  $this->actionService->moveRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, self::VALUE_TargetPageId);
178  }
179 
180  public function ‪changeContentAndCategorySorting(): void
181  {
182  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
183  $this->actionService->moveRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, -self::VALUE_CategoryIdSecond);
184  }
185 
186  public function ‪deleteCategoryRelation(): void
187  {
188  $this->actionService->modifyReferences(
189  self::TABLE_Content,
190  self::VALUE_ContentIdFirst,
191  self::FIELD_Categories,
192  [self::VALUE_CategoryIdFirst]
193  );
194  }
195 
196  public function ‪deleteCategoryRelations(): void
197  {
198  $this->actionService->modifyReferences(
199  self::TABLE_Content,
200  self::VALUE_ContentIdFirst,
201  self::FIELD_Categories,
202  []
203  );
204  }
205 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\moveContentAndCategoryRelationToDifferentPage
‪moveContentAndCategoryRelationToDifferentPage()
Definition: AbstractActionTestCase.php:174
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:127
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\createAndAddCategoryRelation
‪createAndAddCategoryRelation()
Definition: AbstractActionTestCase.php:97
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\changeContentAndCategorySorting
‪changeContentAndCategorySorting()
Definition: AbstractActionTestCase.php:180
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_CategoryIdThird
‪const VALUE_CategoryIdThird
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\addCategoryRelationToExisting
‪addCategoryRelationToExisting()
Definition: AbstractActionTestCase.php:77
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany
Definition: AbstractActionTestCase.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\deleteCategoryRelation
‪deleteCategoryRelation()
Definition: AbstractActionTestCase.php:186
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\deleteCategoryRelations
‪deleteCategoryRelations()
Definition: AbstractActionTestCase.php:196
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\TABLE_Category
‪const TABLE_Category
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\modifyReferencingContentElement
‪modifyReferencingContentElement()
Definition: AbstractActionTestCase.php:156
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_CategoryIdSecond
‪const VALUE_CategoryIdSecond
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_CategoryIdFirst
‪const VALUE_CategoryIdFirst
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\addCategoryRelations
‪addCategoryRelations()
Definition: AbstractActionTestCase.php:67
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_TargetPageId
‪const VALUE_TargetPageId
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\modifyContentOfRelatedCategory
‪modifyContentOfRelatedCategory()
Definition: AbstractActionTestCase.php:165
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\$testExtensionsToLoad
‪$testExtensionsToLoad
Definition: AbstractActionTestCase.php:44
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\createAndReplaceCategoryRelation
‪createAndReplaceCategoryRelation()
Definition: AbstractActionTestCase.php:125
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\addAndDeleteCategoryRelationsOnExisting
‪addAndDeleteCategoryRelationsOnExisting()
Definition: AbstractActionTestCase.php:146
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_CategoryPageId
‪const VALUE_CategoryPageId
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\addCategoryRelationsToExisting
‪addCategoryRelationsToExisting()
Definition: AbstractActionTestCase.php:87
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_CategoryIdFourth
‪const VALUE_CategoryIdFourth
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:48
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\addCategoryRelation
‪addCategoryRelation()
Definition: AbstractActionTestCase.php:57
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\SCENARIO_DataSet
‪const SCENARIO_DataSet
Definition: AbstractActionTestCase.php:42
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase\FIELD_Categories
‪const FIELD_Categories
Definition: AbstractActionTestCase.php:40
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToMany\AbstractActionTestCase
Definition: AbstractActionTestCase.php:26