‪TYPO3CMS  11.5
ActionTest.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 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
22 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\ResponseContent;
23 
28 {
32  public function ‪verifyCleanReferenceIndex(): void
33  {
34  // The test verifies the imported data set has a clean reference index by the check in tearDown()
35  self::assertTrue(true);
36  }
37 
42  public function ‪addCategoryRelation(): void
43  {
44  parent::addCategoryRelation();
45  $this->assertCSVDataSet(__DIR__ . '/DataSet/addCategoryRelation.csv');
46 
47  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
48  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
49 
50  self::assertThat(
51  $responseSections,
53  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_Categories)
54  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category C')
55  );
56  }
57 
62  public function ‪addCategoryRelations(): void
63  {
64  parent::addCategoryRelations();
65  $this->assertCSVDataSet(__DIR__ . '/DataSet/addCategoryRelations.csv');
66 
67  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
68  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
69 
70  self::assertThat(
71  $responseSections,
73  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_Categories)
74  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category C', 'Category A.A')
75  );
76  }
77 
82  public function ‪addCategoryRelationToExisting(): void
83  {
84  parent::addCategoryRelationToExisting();
85  $this->assertCSVDataSet(__DIR__ . '/DataSet/addCategoryRelationToExisting.csv');
86 
87  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
88  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
89 
90  self::assertThat(
91  $responseSections,
93  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
94  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category C')
95  );
96  }
97 
102  public function ‪addCategoryRelationsToExisting(): void
103  {
104  parent::addCategoryRelationsToExisting();
105  $this->assertCSVDataSet(__DIR__ . '/DataSet/addCategoryRelationsToExisting.csv');
106 
107  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
108  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
109 
110  self::assertThat(
111  $responseSections,
113  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
114  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category C', 'Category A.A')
115  );
116  }
117 
122  public function ‪createAndAddCategoryRelation(): void
123  {
124  parent::createAndAddCategoryRelation();
125  $this->assertCSVDataSet(__DIR__ . '/DataSet/createAndAddCategoryRelation.csv');
126 
127  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
128  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
129 
130  self::assertThat(
131  $responseSections,
133  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B.A')
134  );
135 
136  self::assertThat(
137  $responseSections,
139  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
140  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B', 'Category B.A')
141  );
142 
143  self::assertThat(
144  $responseSections,
146  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_Categories)
147  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B.A')
148  );
149  }
150 
155  public function ‪createAndReplaceCategoryRelation(): void
156  {
157  parent::createAndReplaceCategoryRelation();
158  $this->assertCSVDataSet(__DIR__ . '/DataSet/createAndReplaceCategoryRelation.csv');
159 
160  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
161  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
162 
163  self::assertThat(
164  $responseSections,
166  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B.A')
167  );
168 
169  self::assertThat(
170  $responseSections,
172  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
173  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B.A')
174  );
175  }
176 
182  {
183  parent::addAndDeleteCategoryRelationsOnExisting();
184  $this->assertCSVDataSet(__DIR__ . '/DataSet/addAndDeleteCategoryRelationsOnExisting.csv');
185 
186  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
187  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
188 
189  self::assertThat(
190  $responseSections,
192  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
193  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category C')
194  );
195  }
196 
201  public function ‪modifyReferencingContentElement(): void
202  {
203  parent::modifyReferencingContentElement();
204  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyReferencingContentElement.csv');
205 
206  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
207  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
208 
209  self::assertThat(
210  $responseSections,
212  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1')
213  );
214  }
215 
220  public function ‪modifyContentOfRelatedCategory(): void
221  {
222  parent::modifyContentOfRelatedCategory();
223  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyContentOfRelatedCategory.csv');
224 
225  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
226  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
227 
228  self::assertThat(
229  $responseSections,
231  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
232  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Testing #1')
233  );
234  }
235 
241  {
242  parent::moveContentAndCategoryRelationToDifferentPage();
243  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveContentAndCategoryRelationToDifferentPage.csv');
244 
245  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_TargetPageId));
246  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
247 
248  self::assertThat(
249  $responseSections,
251  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
252  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B')
253  );
254  }
255 
260  public function ‪changeContentAndCategorySorting(): void
261  {
262  parent::changeContentAndCategorySorting();
263  $this->assertCSVDataSet(__DIR__ . '/DataSet/changeContentAndCategorySorting.csv');
264 
265  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
266  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
267 
268  self::assertThat(
269  $responseSections,
271  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
272  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B', 'Category A')
273  );
274  }
275 
280  public function ‪deleteCategoryRelation(): void
281  {
282  parent::deleteCategoryRelation();
283  $this->assertCSVDataSet(__DIR__ . '/DataSet/deleteCategoryRelation.csv');
284 
285  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
286  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
287 
288  self::assertThat(
289  $responseSections,
291  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
292  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A')
293  );
294 
295  self::assertThat(
296  $responseSections,
298  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
299  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B')
300  );
301  }
302 
307  public function ‪deleteCategoryRelations(): void
308  {
309  parent::deleteCategoryRelations();
310  $this->assertCSVDataSet(__DIR__ . '/DataSet/deleteCategoryRelations.csv');
311 
312  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
313  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
314 
315  self::assertThat(
316  $responseSections,
318  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Categories)
319  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A', 'Category B')
320  );
321  }
322 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\AbstractActionTestCase
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\addCategoryRelation
‪addCategoryRelation()
Definition: ActionTest.php:42
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionHasRecordConstraint
‪HasRecordConstraint getRequestSectionHasRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:245
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureHasRecordConstraint
‪StructureHasRecordConstraint getRequestSectionStructureHasRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:261
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\addAndDeleteCategoryRelationsOnExisting
‪addAndDeleteCategoryRelationsOnExisting()
Definition: ActionTest.php:181
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\moveContentAndCategoryRelationToDifferentPage
‪moveContentAndCategoryRelationToDifferentPage()
Definition: ActionTest.php:240
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\changeContentAndCategorySorting
‪changeContentAndCategorySorting()
Definition: ActionTest.php:260
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureDoesNotHaveRecordConstraint
‪StructureDoesNotHaveRecordConstraint getRequestSectionStructureDoesNotHaveRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:269
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\addCategoryRelations
‪addCategoryRelations()
Definition: ActionTest.php:62
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\modifyReferencingContentElement
‪modifyReferencingContentElement()
Definition: ActionTest.php:201
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\deleteCategoryRelation
‪deleteCategoryRelation()
Definition: ActionTest.php:280
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\addCategoryRelationsToExisting
‪addCategoryRelationsToExisting()
Definition: ActionTest.php:102
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest
Definition: ActionTest.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\modifyContentOfRelatedCategory
‪modifyContentOfRelatedCategory()
Definition: ActionTest.php:220
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\deleteCategoryRelations
‪deleteCategoryRelations()
Definition: ActionTest.php:307
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify
Definition: ActionTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\createAndReplaceCategoryRelation
‪createAndReplaceCategoryRelation()
Definition: ActionTest.php:155
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\addCategoryRelationToExisting
‪addCategoryRelationToExisting()
Definition: ActionTest.php:82
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\createAndAddCategoryRelation
‪createAndAddCategoryRelation()
Definition: ActionTest.php:122
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\ManyToMany\Modify\ActionTest\verifyCleanReferenceIndex
‪verifyCleanReferenceIndex()
Definition: ActionTest.php:32