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 {
25  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload'
26  ];
27 
31  protected $testExtensionsToLoad = [
32  'typo3/sysext/impexp/Tests/Functional/Fixtures/Extensions/template_extension'
33  ];
34 
35  protected function setUp()
36  {
37  parent::setUp();
38 
39  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/pages.xml');
40  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/tt_content.xml');
41  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/sys_file.xml');
42  $this->importDataSet(__DIR__ . '/Fixtures/Database/sys_file.xml');
43  }
44 
49  {
50  $this->export->setRecordTypesIncludeFields(
51  [
52  'pages' => [
53  'title',
54  'deleted',
55  'doktype',
56  'hidden',
57  'perms_everybody'
58  ],
59  'tt_content' => [
60  'CType',
61  'header',
62  'header_link',
63  'deleted',
64  'hidden',
65  't3ver_oid'
66  ],
67  'sys_file' => [
68  'storage',
69  'type',
70  'metadata',
71  'identifier',
72  'identifier_hash',
73  'folder_hash',
74  'mime_type',
75  'name',
76  'sha1',
77  'size',
78  'creation_date',
79  'modification_date',
80  ],
81  ]
82  );
83 
84  $this->export->relOnlyTables = [
85  'sys_file',
86  ];
87 
88  $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 1));
89  $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 2));
90  $this->export->export_addRecord('tt_content', BackendUtility::getRecord('tt_content', 1));
91  $this->export->export_addRecord('tt_content', BackendUtility::getRecord('tt_content', 2));
92 
93  $this->setPageTree(1, 1);
94 
95  // After adding ALL records we set relations:
96  for ($a = 0; $a < 10; $a++) {
97  $addR = $this->export->export_addDBRelations($a);
98  if (empty($addR)) {
99  break;
100  }
101  }
102 
103  $this->export->export_addFilesFromRelations();
104  $this->export->export_addFilesFromSysFilesRecords();
105 
106  $out = $this->export->compileMemoryToFileContent('xml');
107 
108  $this->assertXmlStringEqualsXmlFile(__DIR__ . '/../../Fixtures/ImportExportXml/pages-and-ttcontent.xml', $out);
109  }
110 }
static getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)