TYPO3 CMS  TYPO3_7-6
ExportTest.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 
18 
23 {
27  protected $coreExtensionsToLoad = [
28  'rtehtmlarea',
29  'impexp'
30  ];
31 
36  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload',
37  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/_processed_' => 'fileadmin/_processed_'
38  ];
39 
40  protected function setUp()
41  {
42  parent::setUp();
43 
44  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/pages.xml');
45  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/tt_content-with-rte-image-n-file-link.xml');
46  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/sys_file.xml');
47  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/sys_file_reference.xml');
48  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/sys_file_storage.xml');
49  }
50 
55  {
56  $this->export->setRecordTypesIncludeFields(
57  [
58  'pages' => [
59  'title',
60  'deleted',
61  'doktype',
62  'hidden',
63  'perms_everybody'
64  ],
65  'tt_content' => [
66  'CType',
67  'header',
68  'deleted',
69  'hidden',
70  'bodytext',
71  't3ver_oid'
72  ],
73  'sys_file' => [
74  'storage',
75  'type',
76  'metadata',
77  'identifier',
78  'identifier_hash',
79  'folder_hash',
80  'extension',
81  'mime_type',
82  'name',
83  'sha1',
84  'size',
85  'creation_date',
86  'modification_date',
87  ],
88  'sys_file_storage' => [
89  'name',
90  'description',
91  'driver',
92  'configuration',
93  'is_default',
94  'is_browsable',
95  'is_public',
96  'is_writable',
97  'is_online'
98  ]
99  ]
100  );
101 
102  $this->export->relOnlyTables = [
103  'sys_file',
104  'sys_file_storage'
105  ];
106 
107  $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 1));
108  $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 2));
109  $this->export->export_addRecord('tt_content', BackendUtility::getRecord('tt_content', 1));
110 
111  $this->setPageTree(1, 1);
112 
113  // After adding ALL records we set relations:
114  for ($a = 0; $a < 10; $a++) {
115  $addR = $this->export->export_addDBRelations($a);
116  if (empty($addR)) {
117  break;
118  }
119  }
120 
121  $this->export->export_addFilesFromRelations();
122  $this->export->export_addFilesFromSysFilesRecords();
123 
124  $out = $this->export->compileMemoryToFileContent('xml');
125 
126  $this->assertXmlStringEqualsXmlFile(__DIR__ . '/../../Fixtures/ImportExportXml/pages-and-ttcontent-with-rte-image-n-file-link.xml', $out);
127  }
128 }
static getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)