‪TYPO3CMS  ‪main
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 
20 use PHPUnit\Framework\Attributes\Test;
22 use TYPO3\TestingFramework\Core\Functional\Framework\Constraint\RequestSection\DoesNotHaveRecordConstraint;
23 use TYPO3\TestingFramework\Core\Functional\Framework\Constraint\RequestSection\HasRecordConstraint;
24 use TYPO3\TestingFramework\Core\Functional\Framework\Constraint\RequestSection\StructureDoesNotHaveRecordConstraint;
25 use TYPO3\TestingFramework\Core\Functional\Framework\Constraint\RequestSection\StructureHasRecordConstraint;
26 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
27 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\ResponseContent;
28 
30 {
31  #[Test]
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 
38  #[Test]
39  public function ‪createParentContent(): void
40  {
41  parent::createParentContent();
42  $this->assertCSVDataSet(__DIR__ . '/DataSet/createParentContent.csv');
43 
44  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
45  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
46  self::assertThat($responseSections, (new HasRecordConstraint())
47  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
48  }
49 
50  #[Test]
51  public function ‪modifyParentContent(): void
52  {
53  parent::modifyParentContent();
54  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyParentContent.csv');
55 
56  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
57  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
58  self::assertThat($responseSections, (new HasRecordConstraint())
59  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
60  self::assertThat($responseSections, (new StructureHasRecordConstraint())
61  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
62  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
63  }
64 
65  #[Test]
66  public function ‪deleteParentContent(): void
67  {
68  parent::deleteParentContent();
69  $this->assertCSVDataSet(__DIR__ . '/DataSet/deleteParentContent.csv');
70 
71  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
72  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
73  self::assertThat($responseSections, (new DoesNotHaveRecordConstraint())
74  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
75  }
76 
77  #[Test]
78  public function ‪copyParentContent(): void
79  {
80  parent::copyParentContent();
81  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyParentContent.csv');
82 
83  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
84  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
85  self::assertThat($responseSections, (new StructureHasRecordConstraint())
86  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
87  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
88  }
89 
90  #[Test]
91  public function ‪copyParentContentToDifferentPage(): void
92  {
93  parent::copyParentContentToDifferentPage();
94  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyParentContentToDifferentPage.csv');
95 
96  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageIdTarget));
97  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
98  self::assertThat($responseSections, (new StructureHasRecordConstraint())
99  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
100  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
101  }
102 
103  #[Test]
105  {
106  // Create translated page first
107  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
108  parent::copyParentContentToLanguageWithAllChildren();
109  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyParentContentToLanguageWAllChildren.csv');
110 
111  // Set up "danish" to not have overlays - "free" mode
113  'test',
114  $this->‪buildSiteConfiguration(1, '/'),
115  [
116  $this->‪buildDefaultLanguageConfiguration('EN', '/'),
117  $this->‪buildLanguageConfiguration('DA', '/da/', [], 'free'),
118  $this->‪buildLanguageConfiguration('DE', '/de/', ['DA', 'EN']),
119  ]
120  );
121 
122  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
123  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
124  self::assertThat($responseSections, (new StructureHasRecordConstraint())
125  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['localizedContentId'])->setRecordField(self::FIELD_ContentHotel)
126  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
127  }
128 
129  #[Test]
131  {
132  // Create translated page first
133  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
134  parent::localizeParentContentWithAllChildren();
135  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeParentContentWAllChildren.csv');
136 
137  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
138  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
139  self::assertThat($responseSections, (new StructureHasRecordConstraint())
140  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
141  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
142  }
143 
144  #[Test]
146  {
147  // Create translated page first
148  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
149  parent::localizeParentContentWithLanguageSynchronization();
150  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeParentContentSynchronization.csv');
151 
152  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
153  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
154  self::assertThat($responseSections, (new StructureHasRecordConstraint())
155  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
156  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
157  }
158 
159  #[Test]
161  {
162  // Create translated page first
163  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
164  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageIdSecond);
165  parent::localizeParentContentChainLanguageSynchronizationSource();
166  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeParentContentChainLanguageSynchronizationSource.csv');
167 
168  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageIdSecond));
169  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
170  self::assertThat($responseSections, (new StructureHasRecordConstraint())
171  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
172  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Deutsch:] [Translate to Dansk:] Hotel #1', '[Translate to Deutsch:] [Translate to Dansk:] Hotel #2'));
173  }
174 
175  #[Test]
177  {
178  // Create translated page first
179  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
180  parent::localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization();
181  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeParentContentNCreateNestedChildrenWLanguageSynchronization.csv');
182 
183  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
184  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
185  self::assertThat($responseSections, (new StructureHasRecordConstraint())
186  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
187  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1', '[Translate to Dansk:] New Hotel #1'));
188  }
189 
190  #[Test]
192  {
193  // Create translated page first
194  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
195  parent::localizeParentContentAndSetInvalidChildReferenceWithLanguageSynchronization();
196  // the assertion is the same as for localizeParentContentWithLanguageSynchronization()
197  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeParentContentSynchronization.csv');
198 
199  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
200  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
201  self::assertThat($responseSections, (new StructureHasRecordConstraint())
202  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
203  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
204  }
205 
206  #[Test]
208  {
209  // Create translated page first
210  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
211  parent::localizeParentContentAndSetInvalidChildReferenceWithLateLanguageSynchronization();
212  // the assertion is the same as for localizeParentContentWithLanguageSynchronization()
213  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeParentContentSynchronization.csv');
214 
215  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
216  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
217  self::assertThat($responseSections, (new StructureHasRecordConstraint())
218  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
219  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
220  }
221 
222  #[Test]
223  public function ‪changeParentContentSorting(): void
224  {
225  parent::changeParentContentSorting();
226  $this->assertCSVDataSet(__DIR__ . '/DataSet/changeParentContentSorting.csv');
227 
228  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
229  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
230  self::assertThat($responseSections, (new StructureHasRecordConstraint())
231  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
232  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
233  self::assertThat($responseSections, (new StructureHasRecordConstraint())
234  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
235  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
236  }
237 
238  #[Test]
239  public function ‪moveParentContentToDifferentPage(): void
240  {
241  parent::moveParentContentToDifferentPage();
242  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveParentContentToDifferentPage.csv');
243 
244  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageIdTarget));
245  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
246  self::assertThat($responseSections, (new HasRecordConstraint())
247  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
248  self::assertThat($responseSections, (new StructureHasRecordConstraint())
249  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
250  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
251  }
252 
253  #[Test]
255  {
256  parent::moveParentContentToDifferentPageAndChangeSorting();
257  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveParentContentToDifferentPageNChangeSorting.csv');
258 
259  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageIdTarget));
260  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
261  self::assertThat($responseSections, (new HasRecordConstraint())
262  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2', 'Regular Element #1'));
263  self::assertThat($responseSections, (new StructureHasRecordConstraint())
264  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
265  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
266  self::assertThat($responseSections, (new StructureHasRecordConstraint())
267  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
268  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
269  }
270 
271  #[Test]
272  public function ‪modifyPage(): void
273  {
274  parent::modifyPage();
275  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyPage.csv');
276 
277  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
278  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
279  self::assertThat($responseSections, (new HasRecordConstraint())
280  ->setTable(self::TABLE_Page)->setField('title')->setValues('Testing #1'));
281  }
282 
283  #[Test]
284  public function ‪deletePage(): void
285  {
286  parent::deletePage();
287  $this->assertCSVDataSet(__DIR__ . '/DataSet/deletePage.csv');
288 
289  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
290  self::assertEquals(404, $response->getStatusCode());
291  }
292 
293  #[Test]
294  public function ‪copyPage(): void
295  {
296  parent::copyPage();
297  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyPage.csv');
298 
299  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId($this->recordIds['newPageId']));
300  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
301  self::assertThat($responseSections, (new HasRecordConstraint())
302  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
303  }
304 
305  #[Test]
307  {
308  parent::copyPageWithHotelBeforeParentContent();
309  $this->assertCSVDataSet(__DIR__ . '/DataSet/copyPageWHotelBeforeParentContent.csv');
310 
311  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId($this->recordIds['newPageId']));
312  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
313  self::assertThat($responseSections, (new HasRecordConstraint())
314  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2', 'Hotel #1'));
315  }
316 
317  #[Test]
319  {
320  parent::createParentContentWithHotelAndOfferChildren();
321  $this->assertCSVDataSet(__DIR__ . '/DataSet/createParentContentNHotelNOfferChildren.csv');
322 
323  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
324  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
325  self::assertThat($responseSections, (new HasRecordConstraint())
326  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
327  self::assertThat($responseSections, (new StructureHasRecordConstraint())
328  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
329  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
330  }
331 
332  #[Test]
334  {
335  parent::createAndCopyParentContentWithHotelAndOfferChildren();
336  $this->assertCSVDataSet(__DIR__ . '/DataSet/createNCopyParentContentNHotelNOfferChildren.csv');
337 
338  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
339  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
340  self::assertThat($responseSections, (new StructureHasRecordConstraint())
341  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
342  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
343  self::assertThat($responseSections, (new StructureHasRecordConstraint())
344  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentHotel)
345  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
346  self::assertThat($responseSections, (new StructureHasRecordConstraint())
347  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['copiedHotelId'])->setRecordField(self::FIELD_HotelOffer)
348  ->setTable(self::TABLE_Offer)->setField('title')->setValues('Offer #1'));
349  }
350 
351  #[Test]
353  {
354  // Create translated page first
355  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
356  parent::createAndLocalizeParentContentWithHotelAndOfferChildren();
357  $this->assertCSVDataSet(__DIR__ . '/DataSet/createNLocalizeParentContentNHotelNOfferChildren.csv');
358 
359  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
360  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
361  // Content record gets overlaid, thus using newContentId
362  self::assertThat($responseSections, (new StructureHasRecordConstraint())
363  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
364  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
365  // Hotel record gets overlaid, thus using newHotelId
366  self::assertThat($responseSections, (new StructureHasRecordConstraint())
367  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
368  ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
369  }
370 
371  #[Test]
373  {
374  // Create translated page first
375  $this->actionService->copyRecordToLanguage(self::TABLE_Page, self::VALUE_PageId, self::VALUE_LanguageId);
376  parent::createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration();
377  $this->assertCSVDataSet(__DIR__ . '/DataSet/createNLocalizeParentContentNHotelNOfferChildrenWOSortBy.csv');
378 
379  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
380  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
381  self::assertThat($responseSections, (new HasRecordConstraint())
382  ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Testing #1'));
383  self::assertThat($responseSections, (new StructureHasRecordConstraint())
384  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentHotel)
385  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #1'));
386  self::assertThat($responseSections, (new StructureHasRecordConstraint())
387  ->setRecordIdentifier(self::TABLE_Hotel . ':' . $this->recordIds['newHotelId'])->setRecordField(self::FIELD_HotelOffer)
388  ->setTable(self::TABLE_Offer)->setField('title')->setValues('[Translate to Dansk:] Offer #1'));
389  }
390 
391  #[Test]
392  public function ‪modifyOnlyHotelChild(): void
393  {
394  parent::modifyOnlyHotelChild();
395  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyOnlyHotelChild.csv');
396 
397  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
398  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
399  self::assertThat($responseSections, (new StructureHasRecordConstraint())
400  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
401  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
402  }
403 
404  #[Test]
406  {
407  parent::modifyParentAndChangeHotelChildrenSorting();
408  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyParentNChangeHotelChildrenSorting.csv');
409 
410  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
411  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
412  self::assertThat($responseSections, (new StructureHasRecordConstraint())
413  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
414  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2', 'Hotel #1'));
415  }
416 
417  #[Test]
418  public function ‪modifyParentWithHotelChild(): void
419  {
420  parent::modifyParentWithHotelChild();
421  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyParentNHotelChild.csv');
422 
423  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
424  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
425  self::assertThat($responseSections, (new StructureHasRecordConstraint())
426  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentHotel)
427  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Testing #1'));
428  }
429 
430  #[Test]
431  public function ‪modifyParentAndAddHotelChild(): void
432  {
433  parent::modifyParentAndAddHotelChild();
434  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyParentNAddHotelChild.csv');
435 
436  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
437  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
438  self::assertThat($responseSections, (new StructureHasRecordConstraint())
439  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
440  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1', 'Hotel #2'));
441  }
442 
443  #[Test]
444  public function ‪modifyParentAndDeleteHotelChild(): void
445  {
446  parent::modifyParentAndDeleteHotelChild();
447  $this->assertCSVDataSet(__DIR__ . '/DataSet/modifyParentNDeleteHotelChild.csv');
448 
449  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId));
450  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections('Default', 'Extbase:list()');
451  self::assertThat($responseSections, (new StructureHasRecordConstraint())
452  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
453  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #1'));
454  self::assertThat($responseSections, (new StructureDoesNotHaveRecordConstraint())
455  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentHotel)
456  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #2'));
457  }
458 
459  #[Test]
461  {
462  parent::localizePageWithLocalizationExclude();
463  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageWExclude.csv');
464 
465  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
466  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
467  self::assertThat($responseSections, (new StructureHasRecordConstraint())
468  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
469  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #0'));
470  }
471 
472  #[Test]
474  {
475  parent::localizePageTwiceWithLocalizationExclude();
476  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageTwiceWExclude.csv');
477 
478  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
479  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
480  self::assertThat($responseSections, (new StructureHasRecordConstraint())
481  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
482  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #0'));
483  }
484 
485  #[Test]
487  {
488  parent::localizePageAndAddHotelChildWithLocalizationExclude();
489  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageNAddHotelChildWExclude.csv');
490 
491  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
492  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
493  self::assertThat($responseSections, (new StructureHasRecordConstraint())
494  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
495  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #0', 'Hotel #007'));
496  }
497 
498  #[Test]
500  {
501  parent::localizePageWithLanguageSynchronization();
502  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageWSynchronization.csv');
503 
504  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
505  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
506  self::assertThat($responseSections, (new StructureHasRecordConstraint())
507  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
508  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #0'));
509  }
510 
511  #[Test]
513  {
514  parent::localizePageAndAddHotelChildWithLanguageSynchronization();
515  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageNAddHotelChildWSynchronization.csv');
516 
517  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
518  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
519  self::assertThat($responseSections, (new StructureHasRecordConstraint())
520  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
521  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #0', '[Translate to Dansk:] Hotel #007'));
522  }
523 
524  #[Test]
526  {
527  parent::localizePageAndAddMonoglotHotelChildWithLanguageSynchronization();
528  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageNAddMonoglotHotelChildWSynchronization.csv');
529 
530  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
531  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
532  self::assertThat($responseSections, (new StructureHasRecordConstraint())
533  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
534  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #0', 'Hotel #007'));
535  }
536 
537  #[Test]
539  {
540  parent::localizeAndCopyPageWithLanguageSynchronization();
541  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizeNCopyPageWSynchronization.csv');
542 
543  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
544  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
545  self::assertThat($responseSections, (new StructureHasRecordConstraint())
546  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
547  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #0'));
548  }
549 
554  #[Test]
556  {
557  parent::localizePageWithSynchronizationAndCustomLocalizedHotel();
558  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageWithSynchronizationAndCustomLocalizedHotel.csv');
559 
560  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
561  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
562  self::assertThat($responseSections, (new StructureHasRecordConstraint())
563  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
564  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('[Translate to Dansk:] Hotel #0'));
565  }
566 
567  #[Test]
569  {
570  parent::localizePageAndAddMonoglotHotelChildWithLanguageSynchronization();
571  parent::copyPage();
572  $this->assertCSVDataSet(__DIR__ . '/DataSet/localizePageAddMonoglotHotelChildNCopyPageWSynchronization.csv');
573 
574  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageId)->withLanguageId(self::VALUE_LanguageId));
575  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
576  self::assertThat($responseSections, (new StructureHasRecordConstraint())
577  ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageId)->setRecordField(self::FIELD_PageHotel)
578  ->setTable(self::TABLE_Hotel)->setField('title')->setValues('Hotel #0', 'Hotel #007'));
579  }
580 
581  #[Test]
583  {
584  parent::inlineLocalizeSynchronizeLocalizeMissing();
585  $this->assertCSVDataSet(__DIR__ . '/DataSet/inlineLocalizeSynchronizeLocalizeMissing.csv');
586  }
587 }
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\copyParentContentToDifferentPage
‪copyParentContentToDifferentPage()
Definition: ActionTest.php:91
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizePageTwiceWithLocalizationExclude
‪localizePageTwiceWithLocalizationExclude()
Definition: ActionTest.php:473
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildLanguageConfiguration
‪buildLanguageConfiguration(string $identifier, string $base, array $fallbackIdentifiers=[], string $fallbackType=null)
Definition: SiteBasedTestTrait.php:108
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest
Definition: ActionTest.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\modifyParentAndAddHotelChild
‪modifyParentAndAddHotelChild()
Definition: ActionTest.php:431
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizePageWithLocalizationExclude
‪localizePageWithLocalizationExclude()
Definition: ActionTest.php:460
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizeParentContentAndSetInvalidChildReferenceWithLanguageSynchronization
‪localizeParentContentAndSetInvalidChildReferenceWithLanguageSynchronization()
Definition: ActionTest.php:191
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\modifyParentWithHotelChild
‪modifyParentWithHotelChild()
Definition: ActionTest.php:418
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\copyParentContent
‪copyParentContent()
Definition: ActionTest.php:78
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\modifyParentAndChangeHotelChildrenSorting
‪modifyParentAndChangeHotelChildrenSorting()
Definition: ActionTest.php:405
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\inlineLocalizeSynchronizeLocalizeMissing
‪inlineLocalizeSynchronizeLocalizeMissing()
Definition: ActionTest.php:582
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizeParentContentAndSetInvalidChildReferenceWithLateLanguageSynchronization
‪localizeParentContentAndSetInvalidChildReferenceWithLateLanguageSynchronization()
Definition: ActionTest.php:207
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\changeParentContentSorting
‪changeParentContentSorting()
Definition: ActionTest.php:223
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\createParentContent
‪createParentContent()
Definition: ActionTest.php:39
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\deletePage
‪deletePage()
Definition: ActionTest.php:284
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:50
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\verifyCleanReferenceIndex
‪verifyCleanReferenceIndex()
Definition: ActionTest.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizeParentContentWithAllChildren
‪localizeParentContentWithAllChildren()
Definition: ActionTest.php:130
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:88
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizeAndCopyPageWithLanguageSynchronization
‪localizeAndCopyPageWithLanguageSynchronization()
Definition: ActionTest.php:538
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify
Definition: ActionTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\copyPage
‪copyPage()
Definition: ActionTest.php:294
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizeParentContentChainLanguageSynchronizationSource
‪localizeParentContentChainLanguageSynchronizationSource()
Definition: ActionTest.php:160
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizePageAndAddHotelChildWithLocalizationExclude
‪localizePageAndAddHotelChildWithLocalizationExclude()
Definition: ActionTest.php:486
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\modifyOnlyHotelChild
‪modifyOnlyHotelChild()
Definition: ActionTest.php:392
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\createParentContentWithHotelAndOfferChildren
‪createParentContentWithHotelAndOfferChildren()
Definition: ActionTest.php:318
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\deleteParentContent
‪deleteParentContent()
Definition: ActionTest.php:66
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\copyPageWithHotelBeforeParentContent
‪copyPageWithHotelBeforeParentContent()
Definition: ActionTest.php:306
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizePageWithLanguageSynchronization
‪localizePageWithLanguageSynchronization()
Definition: ActionTest.php:499
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration
‪createAndLocalizeParentContentWithHotelAndOfferChildrenWithoutSortByConfiguration()
Definition: ActionTest.php:372
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizePageWithSynchronizationAndCustomLocalizedHotel
‪localizePageWithSynchronizationAndCustomLocalizedHotel()
Definition: ActionTest.php:555
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\modifyParentContent
‪modifyParentContent()
Definition: ActionTest.php:51
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\copyParentContentToLanguageWithAllChildren
‪copyParentContentToLanguageWithAllChildren()
Definition: ActionTest.php:104
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\modifyParentAndDeleteHotelChild
‪modifyParentAndDeleteHotelChild()
Definition: ActionTest.php:444
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizeParentContentWithLanguageSynchronization
‪localizeParentContentWithLanguageSynchronization()
Definition: ActionTest.php:145
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizePageAddMonoglotHotelChildAndCopyPageWithLanguageSynchronization
‪localizePageAddMonoglotHotelChildAndCopyPageWithLanguageSynchronization()
Definition: ActionTest.php:568
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration
‪buildDefaultLanguageConfiguration(string $identifier, string $base)
Definition: SiteBasedTestTrait.php:98
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\createAndCopyParentContentWithHotelAndOfferChildren
‪createAndCopyParentContentWithHotelAndOfferChildren()
Definition: ActionTest.php:333
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\createAndLocalizeParentContentWithHotelAndOfferChildren
‪createAndLocalizeParentContentWithHotelAndOfferChildren()
Definition: ActionTest.php:352
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\modifyPage
‪modifyPage()
Definition: ActionTest.php:272
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizePageAndAddHotelChildWithLanguageSynchronization
‪localizePageAndAddHotelChildWithLanguageSynchronization()
Definition: ActionTest.php:512
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\moveParentContentToDifferentPage
‪moveParentContentToDifferentPage()
Definition: ActionTest.php:239
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization
‪localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization()
Definition: ActionTest.php:176
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\moveParentContentToDifferentPageAndChangeSorting
‪moveParentContentToDifferentPageAndChangeSorting()
Definition: ActionTest.php:254
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\AbstractActionTestCase
Definition: AbstractActionTestCase.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataScenarios\IrreForeignField\Modify\ActionTest\localizePageAndAddMonoglotHotelChildWithLanguageSynchronization
‪localizePageAndAddMonoglotHotelChildWithLanguageSynchronization()
Definition: ActionTest.php:525