‪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_Category)
54  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category A.A')
55  );
56  }
57 
62  public function ‪createAndAddCategoryRelation(): void
63  {
64  parent::createAndAddCategoryRelation();
65  $this->assertCSVDataSet(__DIR__ . '/DataSet/createAndAddCategoryRelation.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  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B.A')
74  );
75 
76  self::assertThat(
77  $responseSections,
79  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_Category)
80  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B.A')
81  );
82  }
83 
88  public function ‪createAndReplaceCategoryRelation(): void
89  {
90  parent::createAndReplaceCategoryRelation();
91  $this->assertCSVDataSet(__DIR__ . '/DataSet/createAndReplaceCategoryRelation.csv');
92 
93  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
94  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
95 
96  self::assertThat(
97  $responseSections,
99  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B.A')
100  );
101 
102  self::assertThat(
103  $responseSections,
105  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Category)
106  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B.A')
107  );
108  }
109 
114  public function ‪changeExistingCategoryRelation(): void
115  {
116  parent::changeExistingCategoryRelation();
117  $this->assertCSVDataSet(__DIR__ . '/DataSet/changeExistingCategoryRelation.csv');
118 
119  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
120  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
121 
122  self::assertThat(
123  $responseSections,
125  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Category)
126  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category B')
127  );
128  }
129 
134  public function ‪modifyReferencingContentElement(): void
135  {
136  parent::modifyReferencingContentElement();
137  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyReferencingContentElement.csv');
138 
139  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
140  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
141 
142  self::assertThat(
143  $responseSections,
145  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1')
146  );
147  }
148 
153  public function ‪modifyContentOfRelatedCategory(): void
154  {
155  parent::modifyContentOfRelatedCategory();
156  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyContentOfRelatedCategory.csv');
157 
158  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
159  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
160 
161  self::assertThat(
162  $responseSections,
164  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Category)
165  ->setTable(self::TABLE_Category)->setField('title')->setValues('Testing #1')
166  );
167  }
168 
174  {
175  parent::moveContentAndCategoryRelationToDifferentPage();
176  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveContentAndCategoryRelationToDifferentPage.csv');
177 
178  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_TargetPageId));
179  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
180 
181  self::assertThat(
182  $responseSections,
184  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Category)
185  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category C')
186  );
187  }
188 
193  public function ‪changeContentAndCategorySorting(): void
194  {
195  parent::changeContentAndCategorySorting();
196  $this->assertCSVDataSet(__DIR__ . '/DataSet/changeContentAndCategorySorting.csv');
197 
198  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
199  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
200 
201  self::assertThat(
202  $responseSections,
204  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Category)
205  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category C')
206  );
207  }
208 
213  public function ‪copyContentAndCategoryRelation(): void
214  {
215  parent::copyContentAndCategoryRelation();
216  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyContentAndCategoryRelation.csv');
217 
218  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
219  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
220  self::assertThat(
221  $responseSections,
223  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_Category)
224  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category C')
225  );
226  }
227 
232  public function ‪deleteCategoryRelation(): void
233  {
234  parent::deleteCategoryRelation();
235  $this->assertCSVDataSet(__DIR__ . '/DataSet/deleteCategoryRelation.csv');
236 
237  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
238  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
239 
240  self::assertThat(
241  $responseSections,
243  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_Category)
244  ->setTable(self::TABLE_Category)->setField('title')->setValues('Category C')
245  );
246  }
247 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\modifyReferencingContentElement
‪modifyReferencingContentElement()
Definition: ActionTest.php:134
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\changeExistingCategoryRelation
‪changeExistingCategoryRelation()
Definition: ActionTest.php:114
‪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\OneToOne\Modify\ActionTest\addCategoryRelation
‪addCategoryRelation()
Definition: ActionTest.php:42
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureDoesNotHaveRecordConstraint
‪StructureDoesNotHaveRecordConstraint getRequestSectionStructureDoesNotHaveRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:269
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest
Definition: ActionTest.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\changeContentAndCategorySorting
‪changeContentAndCategorySorting()
Definition: ActionTest.php:193
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\moveContentAndCategoryRelationToDifferentPage
‪moveContentAndCategoryRelationToDifferentPage()
Definition: ActionTest.php:173
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\deleteCategoryRelation
‪deleteCategoryRelation()
Definition: ActionTest.php:232
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\AbstractActionTestCase
Definition: AbstractActionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\verifyCleanReferenceIndex
‪verifyCleanReferenceIndex()
Definition: ActionTest.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\modifyContentOfRelatedCategory
‪modifyContentOfRelatedCategory()
Definition: ActionTest.php:153
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify
Definition: ActionTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\createAndReplaceCategoryRelation
‪createAndReplaceCategoryRelation()
Definition: ActionTest.php:88
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\createAndAddCategoryRelation
‪createAndAddCategoryRelation()
Definition: ActionTest.php:62
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Category\OneToOne\Modify\ActionTest\copyContentAndCategoryRelation
‪copyContentAndCategoryRelation()
Definition: ActionTest.php:213