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