‪TYPO3CMS  ‪main
MultilingualPagesAndTtContentTest.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;
23 
25 {
26  protected array ‪$pathsToLinkInTestInstance = [
27  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload',
28  ];
29 
30  protected array ‪$testExtensionsToLoad = [
31  'typo3/sysext/impexp/Tests/Functional/Fixtures/Extensions/template_extension',
32  ];
33 
34  protected array ‪$recordTypesIncludeFields = [
35  'pages' => [
36  'title',
37  'deleted',
38  'doktype',
39  'hidden',
40  'perms_everybody',
41  'l10n_parent',
42  'l10n_source',
43  'sys_language_uid',
44  'sorting',
45  ],
46  'tt_content' => [
47  'CType',
48  'header',
49  'deleted',
50  'l18n_parent', // note l18n vs. l10n
51  'l10n_source',
52  'sys_language_uid',
53  'sorting',
54  ],
55 
56  ];
57 
58  protected function ‪setUp(): void
59  {
60  parent::setUp();
61 
62  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/pages-multilingual.csv');
63  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/tt_content-multilingual.csv');
64  }
65 
66  #[Test]
68  {
69  $subject = $this->getAccessibleMock(Export::class, ['setMetaData']);
70  $subject->setPid(1);
71  $subject->setLevels(1);
72  $subject->setTables(['_ALL']);
73  $subject->setRecordTypesIncludeFields($this->recordTypesIncludeFields);
74  $subject->process();
75 
76  $out = $subject->render();
77 
78  // @todo Use self::assertXmlStringEqualsXmlFile() instead when sqlite issue is sorted out
80  __DIR__ . '/../Fixtures/XmlExports/pages-and-ttcontent-multilingual.xml',
81  $out
82  );
83  }
84 
85  #[Test]
87  {
88  $subject = $this->getAccessibleMock(Export::class, ['setMetaData']);
89  // Restrict to pid=8 which is a the UID of german page, that belongs to a page
90  // with 2 more records (default and french). Exporting that page needs to contain
91  // data from the language parent, which is what's tested here.
92  // The expected output is:
93  // - pages.uid=8 (the german page)
94  // - pages.uid=5 (the parent page with sys_language_uid=0)
95  // - tt_content.uid=4 (german content)
96  // - tt_content.uid=3 (default content)
97  $subject->setPid(8);
98  $subject->setLevels(1);
99  $subject->setTables(['_ALL']);
100  $subject->setRecordTypesIncludeFields($this->recordTypesIncludeFields);
101  $subject->setRelOnlyTables(['_ALL']);
102  $subject->process();
103 
104  $out = $subject->render();
105 
106  // @todo Use self::assertXmlStringEqualsXmlFile() instead when sqlite issue is sorted out
108  __DIR__ . '/../Fixtures/XmlExports/pages-and-ttcontent-multilingual-single.xml',
109  $out
110  );
111  }
112 
113  #[Test]
115  {
116  $subject = $this->getAccessibleMock(Export::class, ['setMetaData']);
117  // Restrict to pid=8 which is a the UID of german page, that belongs to a page
118  // with 2 more records (default and french). This tests that the export does not
119  // contain the language parent and thus not other language records on the same page.
120  // (Difference is not using setRelOnlyTables!)
121  // The expected output is:
122  // - pages.uid=8 (the german page)
123  // - tt_content.uid=4 (german content)
124  $subject->setPid(8);
125  $subject->setLevels(1);
126  $subject->setTables(['_ALL']);
127  $subject->setRecordTypesIncludeFields($this->recordTypesIncludeFields);
128  $subject->process();
129 
130  $out = $subject->render();
131 
132  // @todo Use self::assertXmlStringEqualsXmlFile() instead when sqlite issue is sorted out
134  __DIR__ . '/../Fixtures/XmlExports/pages-and-ttcontent-multilingual-onlysingle.xml',
135  $out
136  );
137  }
138 
139 }
‪TYPO3\CMS\Impexp\Tests\Functional\Export\MultilingualPagesAndTtContentTest\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: MultilingualPagesAndTtContentTest.php:30
‪TYPO3\CMS\Impexp\Tests\Functional\Export\MultilingualPagesAndTtContentTest\$recordTypesIncludeFields
‪array $recordTypesIncludeFields
Definition: MultilingualPagesAndTtContentTest.php:34
‪TYPO3\CMS\Impexp\Tests\Functional\Export\MultilingualPagesAndTtContentTest\exportMultilingualPagesAndRelatedTtContent
‪exportMultilingualPagesAndRelatedTtContent()
Definition: MultilingualPagesAndTtContentTest.php:67
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase\assertXmlStringEqualsXmlFileWithIgnoredSqliteTypeInteger
‪assertXmlStringEqualsXmlFileWithIgnoredSqliteTypeInteger(string $expectedFile, string $actualXml)
Definition: AbstractImportExportTestCase.php:92
‪TYPO3\CMS\Impexp\Tests\Functional\Export\MultilingualPagesAndTtContentTest\exportOnlySingleLanguagePageAndRelatedTtContent
‪exportOnlySingleLanguagePageAndRelatedTtContent()
Definition: MultilingualPagesAndTtContentTest.php:114
‪TYPO3\CMS\Impexp\Tests\Functional\Export\MultilingualPagesAndTtContentTest\exportSingleLanguagePageAndRelatedTtContent
‪exportSingleLanguagePageAndRelatedTtContent()
Definition: MultilingualPagesAndTtContentTest.php:86
‪TYPO3\CMS\Impexp\Tests\Functional\Export\MultilingualPagesAndTtContentTest\$pathsToLinkInTestInstance
‪array $pathsToLinkInTestInstance
Definition: MultilingualPagesAndTtContentTest.php:26
‪TYPO3\CMS\Impexp\Tests\Functional\Export\MultilingualPagesAndTtContentTest
Definition: MultilingualPagesAndTtContentTest.php:25
‪TYPO3\CMS\Impexp\Tests\Functional\Export\MultilingualPagesAndTtContentTest\setUp
‪setUp()
Definition: MultilingualPagesAndTtContentTest.php:58
‪TYPO3\CMS\Impexp\Tests\Functional\Export
Definition: IrreRecordsTest.php:18
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase
Definition: AbstractImportExportTestCase.php:33
‪TYPO3\CMS\Impexp\Export
Definition: Export.php:52