‪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_Category = 'tx_testdatahandler_category';
41 
42  protected const ‪SCENARIO_DataSet = __DIR__ . '/DataSet/ImportDefault.csv';
43 
45  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial',
46  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler',
47  ];
48 
49  protected function ‪setUp(): void
50  {
51  parent::setUp();
52  $this->importCSVDataSet(static::SCENARIO_DataSet);
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(): void
59  {
60  $this->actionService->modifyRecord(
61  self::TABLE_Content,
62  self::VALUE_ContentIdLast,
63  [self::FIELD_Category => self::VALUE_CategoryIdFourth]
64  );
65  }
66 
67  public function ‪createAndAddCategoryRelation(): void
68  {
69  $newTableIds = $this->actionService->createNewRecord(
70  self::TABLE_Category,
71  self::VALUE_CategoryPageId,
72  [
73  'title' => 'Category B.A',
74  'parent' => self::VALUE_CategoryIdSecond,
75  ]
76  );
77 
78  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
79 
80  $this->actionService->modifyRecord(
81  self::TABLE_Content,
82  self::VALUE_ContentIdLast,
83  [self::FIELD_Category => $this->recordIds['newCategoryId']]
84  );
85  }
86 
87  public function ‪createAndReplaceCategoryRelation(): void
88  {
89  $newTableIds = $this->actionService->createNewRecord(
90  self::TABLE_Category,
91  self::VALUE_CategoryPageId,
92  [
93  'title' => 'Category B.A',
94  'parent' => self::VALUE_CategoryIdSecond,
95  ]
96  );
97 
98  $this->recordIds['newCategoryId'] = $newTableIds[‪self::TABLE_Category][0];
99 
100  $this->actionService->modifyRecord(
101  self::TABLE_Content,
102  self::VALUE_ContentIdFirst,
103  [self::FIELD_Category => $this->recordIds['newCategoryId']]
104  );
105  }
106 
107  public function ‪changeExistingCategoryRelation(): void
108  {
109  $this->actionService->modifyRecord(
110  self::TABLE_Content,
111  self::VALUE_ContentIdFirst,
112  [self::FIELD_Category => self::VALUE_CategoryIdSecond]
113  );
114  }
115 
116  public function ‪modifyReferencingContentElement(): void
117  {
118  $this->actionService->modifyRecord(
119  self::TABLE_Content,
120  self::VALUE_ContentIdFirst,
121  ['header' => 'Testing #1']
122  );
123  }
124 
125  public function ‪modifyContentOfRelatedCategory(): void
126  {
127  $this->actionService->modifyRecord(
128  self::TABLE_Category,
129  self::VALUE_CategoryIdThird,
130  ['title' => 'Testing #1']
131  );
132  }
133 
135  {
136  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, self::VALUE_TargetPageId);
137  $this->actionService->moveRecord(self::TABLE_Category, self::VALUE_CategoryIdThird, self::VALUE_TargetPageId);
138  }
139 
140  public function ‪changeContentAndCategorySorting(): void
141  {
142  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
143  $this->actionService->moveRecord(self::TABLE_Category, self::VALUE_CategoryIdThird, -self::VALUE_CategoryIdFourth);
144  }
145 
146  public function ‪copyContentAndCategoryRelation(): void
147  {
148  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, self::VALUE_PageId);
149  $this->recordIds['copiedContentId'] = $newTableIds[‪self::TABLE_Content][‪self::VALUE_ContentIdFirst];
150  $newTableIds = $this->actionService->copyRecord(self::TABLE_Category, self::VALUE_CategoryIdFourth, self::VALUE_CategoryPageId);
151  $this->recordIds['copiedCategoryId'] = $newTableIds[‪self::TABLE_Category][‪self::VALUE_CategoryIdFourth];
152  }
153 
154  public function ‪deleteCategoryRelation(): void
155  {
156  $this->actionService->modifyRecord(
157  self::TABLE_Content,
158  self::VALUE_ContentIdFirst,
159  [self::FIELD_Category => 0]
160  );
161  }
162 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\deleteCategoryRelation
‪deleteCategoryRelation()
Definition: AbstractActionTestCase.php:154
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_PageId
‪const VALUE_PageId
Definition: AbstractActionTestCase.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:127
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_CategoryIdFourth
‪const VALUE_CategoryIdFourth
Definition: AbstractActionTestCase.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\setUp
‪setUp()
Definition: AbstractActionTestCase.php:49
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\changeContentAndCategorySorting
‪changeContentAndCategorySorting()
Definition: AbstractActionTestCase.php:140
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\$testExtensionsToLoad
‪$testExtensionsToLoad
Definition: AbstractActionTestCase.php:44
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\TABLE_Category
‪const TABLE_Category
Definition: AbstractActionTestCase.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_CategoryPageId
‪const VALUE_CategoryPageId
Definition: AbstractActionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\copyContentAndCategoryRelation
‪copyContentAndCategoryRelation()
Definition: AbstractActionTestCase.php:146
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_CategoryIdThird
‪const VALUE_CategoryIdThird
Definition: AbstractActionTestCase.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\TABLE_Content
‪const TABLE_Content
Definition: AbstractActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_TargetPageId
‪const VALUE_TargetPageId
Definition: AbstractActionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_CategoryIdSecond
‪const VALUE_CategoryIdSecond
Definition: AbstractActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\SCENARIO_DataSet
‪const SCENARIO_DataSet
Definition: AbstractActionTestCase.php:42
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_CategoryIdFirst
‪const VALUE_CategoryIdFirst
Definition: AbstractActionTestCase.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_ContentIdFirst
‪const VALUE_ContentIdFirst
Definition: AbstractActionTestCase.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne
Definition: AbstractActionTestCase.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\moveContentAndCategoryRelationToDifferentPage
‪moveContentAndCategoryRelationToDifferentPage()
Definition: AbstractActionTestCase.php:134
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\createAndReplaceCategoryRelation
‪createAndReplaceCategoryRelation()
Definition: AbstractActionTestCase.php:87
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\changeExistingCategoryRelation
‪changeExistingCategoryRelation()
Definition: AbstractActionTestCase.php:107
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\FIELD_Category
‪const FIELD_Category
Definition: AbstractActionTestCase.php:40
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\addCategoryRelation
‪addCategoryRelation()
Definition: AbstractActionTestCase.php:58
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\VALUE_ContentIdLast
‪const VALUE_ContentIdLast
Definition: AbstractActionTestCase.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\modifyReferencingContentElement
‪modifyReferencingContentElement()
Definition: AbstractActionTestCase.php:116
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\modifyContentOfRelatedCategory
‪modifyContentOfRelatedCategory()
Definition: AbstractActionTestCase.php:125
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase\createAndAddCategoryRelation
‪createAndAddCategoryRelation()
Definition: AbstractActionTestCase.php:67