‪TYPO3CMS  11.5
ParentChildTranslationTest.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 TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
21 
23 
24 final class ‪ParentChildTranslationTest extends FunctionalTestCase
25 {
26  protected ‪$testExtensionsToLoad = ['typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/parent_child_translation'];
27 
28  protected function ‪setUp(): void
29  {
30  parent::setUp();
31 
32  $this->importCSVDataSet(__DIR__ . '/Fixtures/parentChildTranslationExampleData.csv');
33  }
34 
39  {
40  $query = $this->get(MainRepository::class)->createQuery();
41  $results = $query->execute();
42 
43  self::assertCount(2, $results);
44 
45  $children = [];
46  foreach ($results as $main) {
47  $children[] = $main->getChild()->getTitle();
48  $children[] = $main->getSqueeze()[0]->getChild()->getTitle();
49  }
50 
51  self::assertSame(
52  [
53  'Child 1 EN',
54  'Child 1 EN',
55  'Child 2 EN',
56  'Child 3 EN',
57  ],
58  $children
59  );
60  }
61 
66  {
67  $query = $this->get(MainRepository::class)->createQuery();
68  $querySettings = $query->getQuerySettings();
69  $querySettings->setStoragePageIds([1]);
70  $querySettings->setRespectSysLanguage(true);
71  $querySettings->setLanguageUid(1);
72  $querySettings->setLanguageOverlayMode('0');
73 
74  $results = $query->execute();
75 
76  self::assertCount(2, $results);
77 
78  $children = [];
79  foreach ($results as $main) {
80  $children[] = $main->getChild()->getTitle();
81  $children[] = $main->getSqueeze()[0]->getChild()->getTitle();
82  }
83 
84  self::assertSame(
85  [
86  'Kind 1 DE',
87  'Kind 1 DE',
88  'Kind 2 DE',
89  'Kind 3 DE',
90  ],
91  $children
92  );
93  }
94 }
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\ParentChildTranslationTest\localizesChildrenOfAllLanguageElementToTranslation
‪localizesChildrenOfAllLanguageElementToTranslation()
Definition: ParentChildTranslationTest.php:65
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence
Definition: AddTest.php:18
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\ParentChildTranslationTest
Definition: ParentChildTranslationTest.php:25
‪TYPO3Tests\ParentChildTranslation\Domain\Repository\MainRepository
Definition: MainRepository.php:28
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\ParentChildTranslationTest\localizeChildrenOfAllLanguageElementToDefaultLanguage
‪localizeChildrenOfAllLanguageElementToDefaultLanguage()
Definition: ParentChildTranslationTest.php:38
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\ParentChildTranslationTest\setUp
‪setUp()
Definition: ParentChildTranslationTest.php:28
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\ParentChildTranslationTest\$testExtensionsToLoad
‪$testExtensionsToLoad
Definition: ParentChildTranslationTest.php:26