‪TYPO3CMS  9.5
PagesAndTtContentTest.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 
21 
26 {
30  protected ‪$pathsToLinkInTestInstance = [
31  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload'
32  ];
33 
37  protected ‪$testExtensionsToLoad = [
38  'typo3/sysext/impexp/Tests/Functional/Fixtures/Extensions/template_extension'
39  ];
40 
41  protected function ‪setUp()
42  {
43  parent::setUp();
44 
45  $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/pages.xml');
46  $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/tt_content.xml');
47  $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file.xml');
48  $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file-export-pages-and-tt-content.xml');
49  }
50 
54  public function ‪exportPagesAndRelatedTtContent()
55  {
56  $subject = GeneralUtility::makeInstance(Export::class);
57  $subject->init();
58 
59  $subject->setRecordTypesIncludeFields(
60  [
61  'pages' => [
62  'title',
63  'deleted',
64  'doktype',
65  'hidden',
66  'perms_everybody'
67  ],
68  'tt_content' => [
69  'CType',
70  'header',
71  'header_link',
72  'deleted',
73  'hidden',
74  't3ver_oid'
75  ],
76  'sys_file' => [
77  'storage',
78  'type',
79  'metadata',
80  'identifier',
81  'identifier_hash',
82  'folder_hash',
83  'mime_type',
84  'name',
85  'sha1',
86  'size',
87  'creation_date',
88  'modification_date',
89  ],
90  ]
91  );
92 
93  $subject->relOnlyTables = [
94  'sys_file',
95  ];
96 
97  // @todo: Do not rely on BackendUtility::getRecord() in the test case itself
98  $subject->export_addRecord('pages', $this->‪forceStringsOnRowValues(‪BackendUtility::getRecord('pages', 1)));
99  $subject->export_addRecord('pages', $this->‪forceStringsOnRowValues(‪BackendUtility::getRecord('pages', 2)));
100  $subject->export_addRecord('tt_content', $this->‪forceStringsOnRowValues(‪BackendUtility::getRecord('tt_content', 1)));
101  $subject->export_addRecord('tt_content', $this->‪forceStringsOnRowValues(‪BackendUtility::getRecord('tt_content', 2)));
102 
103  $this->‪setPageTree($subject, 1, 1);
104 
105  // After adding ALL records we set relations:
106  for ($a = 0; $a < 10; $a++) {
107  $addR = $subject->export_addDBRelations($a);
108  if (empty($addR)) {
109  break;
110  }
111  }
112 
113  $subject->export_addFilesFromRelations();
114  $subject->export_addFilesFromSysFilesRecords();
115 
116  $out = $subject->compileMemoryToFileContent('xml');
117 
118  $this->assertXmlStringEqualsXmlFile(
119  __DIR__ . '/../Fixtures/XmlExports/pages-and-ttcontent.xml',
120  $out
121  );
122  }
123 }
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: PagesAndTtContentTest.php:35
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest\$pathsToLinkInTestInstance
‪array $pathsToLinkInTestInstance
Definition: PagesAndTtContentTest.php:29
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest\setUp
‪setUp()
Definition: PagesAndTtContentTest.php:39
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest
Definition: PagesAndTtContentTest.php:26
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase\setPageTree
‪setPageTree(Export $export, $pidToStart, $depth=1)
Definition: AbstractImportExportTestCase.php:80
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecord
‪static array null getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)
Definition: BackendUtility.php:130
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest\exportPagesAndRelatedTtContent
‪exportPagesAndRelatedTtContent()
Definition: PagesAndTtContentTest.php:52
‪TYPO3\CMS\Impexp\Tests\Functional\Export
Definition: GroupFileAndFileReferenceItemInFlexFormTest.php:2
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase
Definition: AbstractImportExportTestCase.php:30
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase\forceStringsOnRowValues
‪array forceStringsOnRowValues(array $row)
Definition: AbstractImportExportTestCase.php:155
‪TYPO3\CMS\Impexp\Export
Definition: Export.php:62
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45