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