‪TYPO3CMS  10.4
AbstractActionTestCase.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 
24 {
25  const ‪VALUE_PageId = 89;
35 
36  const ‪TABLE_Page = 'pages';
37  const ‪TABLE_Content = 'tt_content';
38  const ‪TABLE_Category = 'sys_category';
39  const ‪TABLE_ContentCategory_ManyToMany = 'sys_category_record_mm';
40 
41  const ‪FIELD_Categories = 'categories';
42 
46  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/';
47 
48  protected function ‪setUp(): void
49  {
50  parent::setUp();
51  $this->‪importScenarioDataSet('LiveDefaultPages');
52  $this->‪importScenarioDataSet('LiveDefaultElements');
53 
54  $this->‪setUpFrontendSite(1, $this->siteLanguageConfiguration);
55  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
56  }
57 
58  public function ‪addCategoryRelation()
59  {
60  $this->actionService->modifyReferences(
61  self::TABLE_Content,
62  self::VALUE_ContentIdFirst,
63  'categories',
64  [self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdSecond, 31]
65  );
66  }
67 
68  public function ‪deleteCategoryRelation()
69  {
70  $this->actionService->modifyReferences(
71  self::TABLE_Content,
72  self::VALUE_ContentIdFirst,
73  'categories',
74  [self::VALUE_CategoryIdFirst]
75  );
76  }
77 
78  public function ‪changeCategoryRelationSorting()
79  {
80  $this->actionService->modifyReferences(
81  self::TABLE_Content,
82  self::VALUE_ContentIdFirst,
83  'categories',
84  [self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdFirst]
85  );
86  }
87 
88  public function ‪modifyCategoryOfRelation()
89  {
90  $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, ['title' => 'Testing #1']);
91  }
92 
93  public function ‪modifyContentOfRelation()
94  {
95  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
96  }
97 
98  public function ‪modifyBothsOfRelation()
99  {
100  $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, ['title' => 'Testing #1']);
101  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
102  }
103 
104  public function ‪deleteContentOfRelation()
105  {
106  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
107  }
108 
109  public function ‪deleteCategoryOfRelation()
110  {
111  $this->actionService->deleteRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst);
112  }
113 
114  public function ‪copyContentOfRelation()
115  {
116  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
117  $this->recordIds['newContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
118  }
119 
120  public function ‪copyCategoryOfRelation()
121  {
122  $newTableIds = $this->actionService->copyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, 0);
123  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][‪self::VALUE_CategoryIdFirst];
124  }
125 
129  public function ‪copyContentToLanguageOfRelation()
130  {
131  $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
132  }
133 
137  public function ‪copyCategoryToLanguageOfRelation()
138  {
139  $this->actionService->copyRecordToLanguage(self::TABLE_Category, self::VALUE_CategoryIdFirst, self::VALUE_LanguageId);
140  }
141 
142  public function ‪localizeContentOfRelation()
143  {
144  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
145  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
146  }
147 
149  {
150  ‪$GLOBALS['TCA'][‪self::TABLE_Content]['columns'][‪self::FIELD_Categories]['config']['behaviour']['allowLanguageSynchronization'] = true;
151  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
152  $this->recordIds['localizedContentId'] = $localizedTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
153  }
154 
156  {
158  $this->actionService->modifyReferences(
159  self::TABLE_Content,
160  self::VALUE_ContentIdLast,
161  self::FIELD_Categories,
162  [self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdThird, self::VALUE_CategoryIdFourth]
163  );
164  }
165 
167  {
169  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['localizedContentId'], self::VALUE_LanguageIdSecond);
170  $this->recordIds['localizedContentIdSecond'] = $localizedTableIds[‪self::TABLE_Content][$this->recordIds['localizedContentId']];
171  $this->actionService->modifyRecord(
172  self::TABLE_Content,
173  $this->recordIds['localizedContentIdSecond'],
174  ['l10n_state' => [self::FIELD_Categories => 'source']]
175  );
176  $this->actionService->modifyReferences(
177  self::TABLE_Content,
178  self::VALUE_ContentIdLast,
179  self::FIELD_Categories,
180  [self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdThird, self::VALUE_CategoryIdFourth]
181  );
182  }
183 
184  public function ‪localizeCategoryOfRelation()
185  {
186  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, self::VALUE_LanguageId);
187  $this->recordIds['localizedCategoryId'] = $localizedTableIds[‪self::TABLE_Category][‪self::VALUE_CategoryIdFirst];
188  }
189 
191  {
192  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
193  }
194 
195  public function ‪copyPage()
196  {
197  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
198  $this->recordIds['newPageId'] = $newTableIds[‪self::TABLE_Page][‪self::VALUE_PageId];
199  $this->recordIds['newContentIdFirst'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdFirst];
200  $this->recordIds['newContentIdLast'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdLast];
201  }
202 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeCategoryOfRelation
‪localizeCategoryOfRelation()
Definition: AbstractActionTestCase.php:183
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\modifyCategoryOfRelation
‪modifyCategoryOfRelation()
Definition: AbstractActionTestCase.php:87
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:143
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyCategoryToLanguageOfRelation
‪copyCategoryToLanguageOfRelation()
Definition: AbstractActionTestCase.php:136
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: AbstractActionTestCase.php:45
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\modifyBothsOfRelation
‪modifyBothsOfRelation()
Definition: AbstractActionTestCase.php:97
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\addCategoryRelation
‪addCategoryRelation()
Definition: AbstractActionTestCase.php:57
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\deleteCategoryRelation
‪deleteCategoryRelation()
Definition: AbstractActionTestCase.php:67
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\deleteCategoryOfRelation
‪deleteCategoryOfRelation()
Definition: AbstractActionTestCase.php:108
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\modifyContentOfRelation
‪modifyContentOfRelation()
Definition: AbstractActionTestCase.php:92
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyContentToLanguageOfRelation
‪copyContentToLanguageOfRelation()
Definition: AbstractActionTestCase.php:128
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_PageIdTarget
‪const VALUE_PageIdTarget
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdThird
‪const VALUE_CategoryIdThird
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\FIELD_Categories
‪const FIELD_Categories
Definition: AbstractActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeContentChainOfRelationAndAddCategoryWithLanguageSynchronization
‪localizeContentChainOfRelationAndAddCategoryWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:165
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdFourth
‪const VALUE_CategoryIdFourth
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_Page
‪const TABLE_Page
Definition: AbstractActionTestCase.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdFirst
‪const VALUE_CategoryIdFirst
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\moveContentOfRelationToDifferentPage
‪moveContentOfRelationToDifferentPage()
Definition: AbstractActionTestCase.php:189
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_ContentCategory_ManyToMany
‪const TABLE_ContentCategory_ManyToMany
Definition: AbstractActionTestCase.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_CategoryIdSecond
‪const VALUE_CategoryIdSecond
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeContentOfRelation
‪localizeContentOfRelation()
Definition: AbstractActionTestCase.php:141
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\deleteContentOfRelation
‪deleteContentOfRelation()
Definition: AbstractActionTestCase.php:103
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeContentOfRelationWithLanguageSynchronization
‪localizeContentOfRelationWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:147
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:47
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\changeCategoryRelationSorting
‪changeCategoryRelationSorting()
Definition: AbstractActionTestCase.php:77
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_LanguageIdSecond
‪const VALUE_LanguageIdSecond
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_LanguageId
‪const VALUE_LanguageId
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\localizeContentOfRelationAndAddCategoryWithLanguageSynchronization
‪localizeContentOfRelationAndAddCategoryWithLanguageSynchronization()
Definition: AbstractActionTestCase.php:154
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyCategoryOfRelation
‪copyCategoryOfRelation()
Definition: AbstractActionTestCase.php:119
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany
Definition: AbstractActionTestCase.php:16
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\TABLE_Category
‪const TABLE_Category
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyPage
‪copyPage()
Definition: AbstractActionTestCase.php:194
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\copyContentOfRelation
‪copyContentOfRelation()
Definition: AbstractActionTestCase.php:113
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:201
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\ManyToMany\AbstractActionTestCase
Definition: AbstractActionTestCase.php:24