[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / impexp / Tests / Functional / Export / GroupFileAndFileReferenceItemInFlexForm / ExportTest.php
1 <?php
2 namespace TYPO3\CMS\Impexp\Tests\Functional\Export\GroupFileAndFileReferenceItemInFlexForm;
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 /**
25 * @var array
26 */
27 protected $testExtensionsToLoad = array(
28 'typo3/sysext/impexp/Tests/Functional/Fixtures/Extensions/impexp_group_files'
29 );
30
31 /**
32 * @var array
33 */
34 protected $pathsToLinkInTestInstance = array(
35 'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload',
36 'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/uploads/tx_impexpgroupfiles' => 'uploads/tx_impexpgroupfiles'
37 );
38
39 protected function setUp() {
40 parent::setUp();
41
42 $this->importDataSet(__DIR__ . '/../../Fixtures/Database/pages.xml');
43 $this->importDataSet(__DIR__ . '/../../Fixtures/Database/sys_file.xml');
44 $this->importDataSet(__DIR__ . '/../../Fixtures/Database/sys_file_storage.xml');
45 $this->importDataSet(__DIR__ . '/../../Fixtures/Database/tx_impexpgroupfiles_item.xml');
46
47 }
48
49 /**
50 * @test
51 */
52 public function exportGroupFileAndFileReferenceItem() {
53
54 $this->export->setRecordTypesIncludeFields(
55 array(
56 'pages' => array(
57 'title',
58 'deleted',
59 'doktype',
60 'hidden',
61 'perms_everybody'
62 ),
63 'sys_file' => array(
64 'storage',
65 'type',
66 'metadata',
67 'extension',
68 'identifier',
69 'identifier_hash',
70 'folder_hash',
71 'mime_type',
72 'name',
73 'sha1',
74 'size',
75 'creation_date',
76 'modification_date',
77 ),
78 'sys_file_storage' => array(
79 'name',
80 'description',
81 'driver',
82 'configuration',
83 'is_default',
84 'is_browsable',
85 'is_public',
86 'is_writable',
87 'is_online'
88 ),
89 'tx_impexpgroupfiles_item' => array(
90 'title',
91 'deleted',
92 'hidden',
93 'images',
94 'image_references',
95 'flexform'
96 ),
97
98 )
99 );
100
101 $this->export->relOnlyTables = array(
102 'sys_file',
103 'sys_file_storage'
104 );
105
106 $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 2));
107 $this->export->export_addRecord('tx_impexpgroupfiles_item', BackendUtility::getRecord('tx_impexpgroupfiles_item', 2));
108
109 $this->setPageTree(2, 0);
110
111 // After adding ALL records we set relations:
112 for ($a = 0; $a < 10; $a++) {
113 $addR = $this->export->export_addDBRelations($a);
114 if (empty($addR)) {
115 break;
116 }
117 }
118
119 // hacky, but the timestamp will change on every clone, so set the file
120 // modification timestamp to the asserted value
121 $success = @touch(PATH_site . 'uploads/tx_impexpgroupfiles/typo3_image4.jpg', 1393866824);
122 if (!$success) {
123 $this->markTestSkipped('Could not set file modification timestamp for a fixture binary file. This is required for running the test successful.');
124 }
125
126 $this->export->export_addFilesFromRelations();
127 $this->export->export_addFilesFromSysFilesRecords();
128
129 $out = $this->export->compileMemoryToFileContent('xml');
130
131 $this->assertXmlStringEqualsXmlFile(__DIR__ . '/../../Fixtures/ImportExportXml/impexp-group-file-and-file_reference-item-in-ff.xml', $out);
132 }
133
134 }