[BUGFIX] mssql: ext:impexp test fixes
[Packages/TYPO3.CMS.git] / typo3 / sysext / impexp / Tests / Functional / Export / PagesAndTtContentTest.php
1 <?php
2 namespace TYPO3\CMS\Impexp\Tests\Functional\Export;
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
17 use TYPO3\CMS\Backend\Utility\BackendUtility;
18 use TYPO3\CMS\Core\Utility\GeneralUtility;
19 use TYPO3\CMS\Impexp\Export;
20 use TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase;
21
22 /**
23 * Test case
24 */
25 class PagesAndTtContentTest extends AbstractImportExportTestCase
26 {
27 /**
28 * @var array
29 */
30 protected $pathsToLinkInTestInstance = [
31 'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload'
32 ];
33
34 /**
35 * @var array
36 */
37 protected $testExtensionsToLoad = [
38 'typo3/sysext/impexp/Tests/Functional/Fixtures/Extensions/template_extension'
39 ];
40
41 protected function setUp()
42 {
43 parent::setUp();
44
45 $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/pages.xml');
46 $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/tt_content.xml');
47 $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file.xml');
48 $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file-export-pages-and-tt-content.xml');
49 }
50
51 /**
52 * @test
53 */
54 public function exportPagesAndRelatedTtContent()
55 {
56 $subject = GeneralUtility::makeInstance(Export::class);
57 $subject->init();
58
59 $subject->setRecordTypesIncludeFields(
60 [
61 'pages' => [
62 'title',
63 'deleted',
64 'doktype',
65 'hidden',
66 'perms_everybody'
67 ],
68 'tt_content' => [
69 'CType',
70 'header',
71 'header_link',
72 'deleted',
73 'hidden',
74 't3ver_oid'
75 ],
76 'sys_file' => [
77 'storage',
78 'type',
79 'metadata',
80 'identifier',
81 'identifier_hash',
82 'folder_hash',
83 'mime_type',
84 'name',
85 'sha1',
86 'size',
87 'creation_date',
88 'modification_date',
89 ],
90 ]
91 );
92
93 $subject->relOnlyTables = [
94 'sys_file',
95 ];
96
97 $subject->export_addRecord('pages', BackendUtility::getRecord('pages', 1));
98 $subject->export_addRecord('pages', BackendUtility::getRecord('pages', 2));
99 $subject->export_addRecord('tt_content', BackendUtility::getRecord('tt_content', 1));
100 $subject->export_addRecord('tt_content', BackendUtility::getRecord('tt_content', 2));
101
102 $this->setPageTree($subject, 1, 1);
103
104 // After adding ALL records we set relations:
105 for ($a = 0; $a < 10; $a++) {
106 $addR = $subject->export_addDBRelations($a);
107 if (empty($addR)) {
108 break;
109 }
110 }
111
112 $subject->export_addFilesFromRelations();
113 $subject->export_addFilesFromSysFilesRecords();
114
115 $out = $subject->compileMemoryToFileContent('xml');
116
117 $this->assertXmlStringEqualsXmlFile(
118 __DIR__ . '/../Fixtures/XmlExports/' . $this->databasePlatform . '/pages-and-ttcontent.xml',
119 $out
120 );
121 }
122 }