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