‪TYPO3CMS  9.5
ActionTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
25  protected ‪$assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Group/Modify/DataSet/';
26 
35  public function ‪addElementRelation()
36  {
37  parent::addElementRelation();
38  $this->‪assertAssertionDataSet('addElementRelation');
39 
40  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
41  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
42  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
43  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2', 'Element #3'));
44  }
45 
50  public function ‪deleteElementRelation()
51  {
52  parent::deleteElementRelation();
53  $this->‪assertAssertionDataSet('deleteElementRelation');
54 
55  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
56  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
57  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
58  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
59  $this->assertThat($responseSections, $this->‪getRequestSectionStructureDoesNotHaveRecordConstraint()
60  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
61  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
62  }
63 
68  public function ‪changeElementSorting()
69  {
70  parent::changeElementSorting();
71  $this->‪assertAssertionDataSet('changeElementSorting');
72 
73  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
74  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
75  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
76  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
77  }
78 
83  public function ‪changeElementRelationSorting()
84  {
85  parent::changeElementRelationSorting();
86  $this->‪assertAssertionDataSet('changeElementRelationSorting');
87 
88  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
89  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
90  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
91  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
92  }
93 
99  {
100  parent::createContentAndAddElementRelation();
101  $this->‪assertAssertionDataSet('createContentNAddRelation');
102 
103  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
104  $this->assertThat($responseSections, $this->‪getRequestSectionHasRecordConstraint()
105  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
106  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
107  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
108  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
109  }
110 
116  {
117  parent::createContentAndCreateElementRelation();
118  $this->‪assertAssertionDataSet('createContentNCreateRelation');
119 
120  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
121  $this->assertThat($responseSections, $this->‪getRequestSectionHasRecordConstraint()
122  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
123  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
124  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
125  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1'));
126  }
127 
132  public function ‪modifyElementOfRelation()
133  {
134  parent::modifyElementOfRelation();
135  $this->‪assertAssertionDataSet('modifyElementOfRelation');
136 
137  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
138  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
139  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
140  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
141  }
142 
147  public function ‪modifyContentOfRelation()
148  {
149  parent::modifyContentOfRelation();
150  $this->‪assertAssertionDataSet('modifyContentOfRelation');
151 
152  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
153  $this->assertThat($responseSections, $this->‪getRequestSectionHasRecordConstraint()
154  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
155  }
156 
161  public function ‪modifyBothSidesOfRelation()
162  {
163  parent::modifyBothSidesOfRelation();
164  $this->‪assertAssertionDataSet('modifyBothSidesOfRelation');
165 
166  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
167  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
168  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
169  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
170  $this->assertThat($responseSections, $this->‪getRequestSectionHasRecordConstraint()
171  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
172  }
173 
178  public function ‪deleteContentOfRelation()
179  {
180  parent::deleteContentOfRelation();
181  $this->‪assertAssertionDataSet('deleteContentOfRelation');
182 
183  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
184  $this->assertThat($responseSections, $this->‪getRequestSectionDoesNotHaveRecordConstraint()
185  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
186  }
187 
192  public function ‪deleteElementOfRelation()
193  {
194  parent::deleteElementOfRelation();
195  $this->‪assertAssertionDataSet('deleteElementOfRelation');
196 
197  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
198  $this->assertThat($responseSections, $this->‪getRequestSectionStructureDoesNotHaveRecordConstraint()
199  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
200  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
201  }
202 
207  public function ‪copyContentOfRelation()
208  {
209  parent::copyContentOfRelation();
210  $this->‪assertAssertionDataSet('copyContentOfRelation');
211 
212  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
213  // Referenced elements are not copied with the "parent", which is expected and correct
214  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
215  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentElement)
216  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
217  }
218 
223  public function ‪copyElementOfRelation()
224  {
225  parent::copyElementOfRelation();
226  $this->‪assertAssertionDataSet('copyElementOfRelation');
227 
228  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
229  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
230  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
231  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
232  // Referenced elements are not updated at the "parent", which is expected and correct
233  $this->assertThat($responseSections, $this->‪getRequestSectionStructureDoesNotHaveRecordConstraint()
234  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
235  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1 (copy 1)'));
236  }
237 
242  public function ‪copyContentToLanguageOfRelation()
243  {
244  parent::copyContentToLanguageOfRelation();
245  $this->‪assertAssertionDataSet('copyContentToLanguageOfRelation');
246 
247  $this->setUpFrontendRootPage(1, [
248  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript',
249  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRendererNoOverlay.typoscript'
250  ]);
251  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
252  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
253  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['localizedContentId'])->setRecordField(self::FIELD_ContentElement)
254  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
255  self::assertThat($responseSections, $this->‪getRequestSectionHasRecordConstraint()
256  ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Regular Element #2'));
257  }
258 
263  public function ‪copyElementToLanguageOfRelation()
264  {
265  parent::copyElementToLanguageOfRelation();
266  $this->‪assertAssertionDataSet('copyElementToLanguageOfRelation');
267 
268  //in this case the translated element is orphaned (no CE with relation to it, and it has no l10n_parent)
269  //so on frontend there is no change.
270  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
271  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
272  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
273  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
274  }
275 
280  public function ‪localizeContentOfRelation()
281  {
282  parent::localizeContentOfRelation();
283  $this->‪assertAssertionDataSet('localizeContentOfRelation');
284 
285  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
286  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
287  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
288  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
289  }
290 
296  {
297  parent::localizeContentOfRelationWithLanguageSynchronization();
298  $this->‪assertAssertionDataSet('localizeContentOfRelationWSynchronization');
299 
300  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
301  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
302  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
303  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
304  }
305 
311  {
312  parent::localizeContentChainOfRelationWithLanguageSynchronizationSource();
313  $this->‪assertAssertionDataSet('localizeContentChainOfRelationWSynchronizationSource');
314 
315  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
316  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
317  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
318  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
319  }
320 
325  public function ‪localizeElementOfRelation()
326  {
327  parent::localizeElementOfRelation();
328  $this->‪assertAssertionDataSet('localizeElementOfRelation');
329 
330  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
331  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
332  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
333  ->setTable(self::TABLE_Element)->setField('title')->setValues('[Translate to Dansk:] Element #1', 'Element #2'));
334  }
335 
341  {
342  parent::moveContentOfRelationToDifferentPage();
343  $this->‪assertAssertionDataSet('moveContentOfRelationToDifferentPage');
344 
345  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
346  $this->assertThat($responseSections, $this->‪getRequestSectionStructureHasRecordConstraint()
347  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
348  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
349  }
350 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\localizeContentChainOfRelationWithLanguageSynchronizationSource
‪localizeContentChainOfRelationWithLanguageSynchronizationSource()
Definition: ActionTest.php:309
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionHasRecordConstraint
‪HasRecordConstraint getRequestSectionHasRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:174
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\moveContentOfRelationToDifferentPage
‪moveContentOfRelationToDifferentPage()
Definition: ActionTest.php:339
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\modifyBothSidesOfRelation
‪modifyBothSidesOfRelation()
Definition: ActionTest.php:160
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\localizeElementOfRelation
‪localizeElementOfRelation()
Definition: ActionTest.php:324
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureHasRecordConstraint
‪StructureHasRecordConstraint getRequestSectionStructureHasRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:190
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\copyContentOfRelation
‪copyContentOfRelation()
Definition: ActionTest.php:206
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\deleteContentOfRelation
‪deleteContentOfRelation()
Definition: ActionTest.php:177
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\changeElementSorting
‪changeElementSorting()
Definition: ActionTest.php:67
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\deleteElementOfRelation
‪deleteElementOfRelation()
Definition: ActionTest.php:191
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify
Definition: ActionTest.php:2
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\localizeContentOfRelation
‪localizeContentOfRelation()
Definition: ActionTest.php:279
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\copyContentToLanguageOfRelation
‪copyContentToLanguageOfRelation()
Definition: ActionTest.php:241
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\addElementRelation
‪addElementRelation()
Definition: ActionTest.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\$assertionDataSetDirectory
‪string $assertionDataSetDirectory
Definition: ActionTest.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureDoesNotHaveRecordConstraint
‪StructureDoesNotHaveRecordConstraint getRequestSectionStructureDoesNotHaveRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:198
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\localizeContentOfRelationWithLanguageSynchronization
‪localizeContentOfRelationWithLanguageSynchronization()
Definition: ActionTest.php:294
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\modifyContentOfRelation
‪modifyContentOfRelation()
Definition: ActionTest.php:146
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest
Definition: ActionTest.php:21
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\createContentAndCreateElementRelation
‪createContentAndCreateElementRelation()
Definition: ActionTest.php:114
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\assertAssertionDataSet
‪assertAssertionDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:124
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\deleteElementRelation
‪deleteElementRelation()
Definition: ActionTest.php:49
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionDoesNotHaveRecordConstraint
‪DoesNotHaveRecordConstraint getRequestSectionDoesNotHaveRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:182
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\AbstractActionTestCase
Definition: AbstractActionTestCase.php:21
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\copyElementToLanguageOfRelation
‪copyElementToLanguageOfRelation()
Definition: ActionTest.php:262
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\changeElementRelationSorting
‪changeElementRelationSorting()
Definition: ActionTest.php:82
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\createContentAndAddElementRelation
‪createContentAndAddElementRelation()
Definition: ActionTest.php:97
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\modifyElementOfRelation
‪modifyElementOfRelation()
Definition: ActionTest.php:131
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Group\Modify\ActionTest\copyElementOfRelation
‪copyElementOfRelation()
Definition: ActionTest.php:222