‪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 = 89;
28  protected const ‪VALUE_PageIdTarget = 90;
29  protected const ‪VALUE_ContentIdFirst = 297;
30  protected const ‪VALUE_ContentIdLast = 298;
31  protected const ‪VALUE_LanguageId = 1;
32  protected const ‪VALUE_LanguageIdSecond = 2;
33  protected const ‪VALUE_CategoryIdFirst = 28;
34  protected const ‪VALUE_CategoryIdSecond = 29;
35  protected const ‪VALUE_CategoryIdThird = 30;
36  protected const ‪VALUE_CategoryIdFourth = 31;
37 
38  protected const ‪TABLE_Page = 'pages';
39  protected const ‪TABLE_Content = 'tt_content';
40  protected const ‪TABLE_Category = 'sys_category';
41  protected const ‪TABLE_ContentCategory_ManyToMany = 'sys_category_record_mm';
42 
43  protected const ‪FIELD_Categories = 'categories';
44 
45  protected const ‪SCENARIO_DataSet = __DIR__ . '/DataSet/ImportDefault.csv';
46 
48  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial',
49  ];
50 
51  protected function ‪setUp(): void
52  {
53  parent::setUp();
54  $this->importCSVDataSet(static::SCENARIO_DataSet);
55 
56  $this->‪setUpFrontendSite(1, $this->siteLanguageConfiguration);
57  $this->setUpFrontendRootPage(1, ['typo3/sysext/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_ContentIdFirst,
65  'categories',
66  [self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdSecond, 31]
67  );
68  }
69 
70  public function ‪createCategoryAndAddRelation(): void
71  {
72  $newTableIds = $this->actionService->createNewRecord(
73  self::TABLE_Category,
74  0,
75  ['title' => 'Testing #1', 'items' => 'tt_content_' . self::VALUE_ContentIdFirst]
76  );
77  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
78  }
79 
80  public function ‪deleteCategoryRelation(): void
81  {
82  $this->actionService->modifyReferences(
83  self::TABLE_Content,
84  self::VALUE_ContentIdFirst,
85  'categories',
86  [self::VALUE_CategoryIdFirst]
87  );
88  }
89 
90  public function ‪changeCategoryRelationSorting(): void
91  {
92  $this->actionService->modifyReferences(
93  self::TABLE_Content,
94  self::VALUE_ContentIdFirst,
95  'categories',
96  [self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdFirst]
97  );
98  }
99 
100  public function ‪modifyCategoryOfRelation(): void
101  {
102  $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, ['title' => 'Testing #1']);
103  }
104 
105  public function ‪modifyContentOfRelation(): void
106  {
107  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
108  }
109 
110  public function ‪modifyBothsOfRelation(): void
111  {
112  $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, ['title' => 'Testing #1']);
113  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
114  }
115 
116  public function ‪deleteContentOfRelation(): void
117  {
118  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
119  }
120 
121  public function ‪deleteCategoryOfRelation(): void
122  {
123  $this->actionService->deleteRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst);
124  }
125 
126  public function ‪copyContentOfRelation(): void
127  {
128  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
129  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
130  }
131 
132  public function ‪copyCategoryOfRelation(): void
133  {
134  $newTableIds = $this->actionService->copyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, 0);
135  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][‪self::VALUE_CategoryIdFirst];
136  }
137 
142  public function ‪copyContentToLanguageOfRelation(): void
143  {
144  $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
145  }
146 
151  public function ‪copyCategoryToLanguageOfRelation(): void
152  {
153  $this->actionService->copyRecordToLanguage(self::TABLE_Category, self::VALUE_CategoryIdFirst, self::VALUE_LanguageId);
154  }
155 
156  public function ‪localizeContentOfRelation(): void
157  {
158  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
159  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
160  }
161 
166  {
167  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_Categories]['config']['behaviour']['allowLanguageSynchronization'] = true;
168  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
169  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
170  }
171 
176  {
177  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_Categories]['config']['behaviour']['allowLanguageSynchronization'] = true;
178  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
179  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
180  $this->actionService->modifyReferences(
181  self::TABLE_Content,
182  self::VALUE_ContentIdLast,
183  self::FIELD_Categories,
184  [self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdThird, self::VALUE_CategoryIdFourth]
185  );
186  }
187 
192  {
193  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_Categories]['config']['behaviour']['allowLanguageSynchronization'] = true;
194  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
195  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
196  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['localizedContentId'], self::VALUE_LanguageIdSecond);
197  $this->recordIds['localizedContentIdSecond'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['localizedContentId']];
198  $this->actionService->modifyRecord(
199  self::TABLE_Content,
200  $this->recordIds['localizedContentIdSecond'],
201  ['l10n_state' => [self::FIELD_Categories => 'source']]
202  );
203  $this->actionService->modifyReferences(
204  self::TABLE_Content,
205  self::VALUE_ContentIdLast,
206  self::FIELD_Categories,
207  [self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdThird, self::VALUE_CategoryIdFourth]
208  );
209  }
210 
211  public function ‪localizeCategoryOfRelation(): void
212  {
213  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, self::VALUE_LanguageId);
214  $this->recordIds['localizedCategoryId'] = $localizedTableIds[‪self::TABLE_Category][‪self::VALUE_CategoryIdFirst];
215  }
216 
218  {
219  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
220  }
221 
222  public function ‪copyPage(): void
223  {
224  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
225  $this->recordIds['newPageId'] = $newTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
226  $this->recordIds['newContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdFirst];
227  $this->recordIds['newContentIdLast'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
228  }
229 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeCategoryOfRelation
‪localizeCategoryOfRelation()
Definition: AbstractActionTestCase.php:211
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\modifyCategoryOfRelation
‪modifyCategoryOfRelation()
Definition: AbstractActionTestCase.php:100
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:127
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyCategoryToLanguageOfRelation
‪copyCategoryToLanguageOfRelation()
Definition: AbstractActionTestCase.php:151
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\modifyBothsOfRelation
‪modifyBothsOfRelation()
Definition: AbstractActionTestCase.php:110
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\addCategoryRelation
‪addCategoryRelation()
Definition: AbstractActionTestCase.php:60
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\deleteCategoryRelation
‪deleteCategoryRelation()
Definition: AbstractActionTestCase.php:80
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\deleteCategoryOfRelation
‪deleteCategoryOfRelation()
Definition: AbstractActionTestCase.php:121
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\modifyContentOfRelation
‪modifyContentOfRelation()
Definition: AbstractActionTestCase.php:105
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyContentToLanguageOfRelation
‪copyContentToLanguageOfRelation()
Definition: AbstractActionTestCase.php:142
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdThird
‪const VALUE_CategoryIdThird
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\FIELD_Categories
‪const FIELD_Categories
Definition: AbstractActionTestCase.php:43
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeContentChainOfRelationAndAddCategoryWithLanguageSynchronization
‪localizeContentChainOfRelationAndAddCategoryWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:191
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\$testExtensionsToLoad
‪$testExtensionsToLoad
Definition: AbstractActionTestCase.php:47
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdFourth
‪const VALUE_CategoryIdFourth
Definition: AbstractActionTestCase.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_Page
‪const TABLE_Page
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdFirst
‪const VALUE_CategoryIdFirst
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\moveContentOfRelationToDifferentPage
‪moveContentOfRelationToDifferentPage()
Definition: AbstractActionTestCase.php:217
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_ContentCategory_ManyToMany
‪const TABLE_ContentCategory_ManyToMany
Definition: AbstractActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\createCategoryAndAddRelation
‪createCategoryAndAddRelation()
Definition: AbstractActionTestCase.php:70
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdSecond
‪const VALUE_CategoryIdSecond
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeContentOfRelation
‪localizeContentOfRelation()
Definition: AbstractActionTestCase.php:156
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\deleteContentOfRelation
‪deleteContentOfRelation()
Definition: AbstractActionTestCase.php:116
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeContentOfRelationWithLanguageSynchronization
‪localizeContentOfRelationWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:165
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:51
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\changeCategoryRelationSorting
‪changeCategoryRelationSorting()
Definition: AbstractActionTestCase.php:90
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_LanguageIdSecond
‪const VALUE_LanguageIdSecond
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeContentOfRelationAndAddCategoryWithLanguageSynchronization
‪localizeContentOfRelationAndAddCategoryWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:175
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyCategoryOfRelation
‪copyCategoryOfRelation()
Definition: AbstractActionTestCase.php:132
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany
Definition: AbstractActionTestCase.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_Category
‪const TABLE_Category
Definition: AbstractActionTestCase.php:40
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyPage
‪copyPage()
Definition: AbstractActionTestCase.php:222
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyContentOfRelation
‪copyContentOfRelation()
Definition: AbstractActionTestCase.php:126
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\SCENARIO_DataSet
‪const SCENARIO_DataSet
Definition: AbstractActionTestCase.php:45
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase
Definition: AbstractActionTestCase.php:26