TYPO3 CMS  TYPO3_8-7
PagesAndTtContentTest.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 
26 {
31  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload'
32  ];
33 
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 
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 }
static makeInstance($className,... $constructorArguments)
static getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)