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