‪TYPO3CMS  10.4
PagesAndTtContentTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 
27 {
31  protected ‪$pathsToLinkInTestInstance = [
32  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload'
33  ];
34 
38  protected ‪$testExtensionsToLoad = [
39  'typo3/sysext/impexp/Tests/Functional/Fixtures/Extensions/template_extension'
40  ];
41 
42  protected function ‪setUp(): void
43  {
44  parent::setUp();
45 
46  $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/pages.xml');
47  $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/tt_content.xml');
48  $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file.xml');
49  $this->importDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file-export-pages-and-tt-content.xml');
50  }
51 
55  public function ‪exportPagesAndRelatedTtContent()
56  {
57  $subject = GeneralUtility::makeInstance(Export::class);
58  $subject->init();
59 
60  $subject->setRecordTypesIncludeFields(
61  [
62  'pages' => [
63  'title',
64  'deleted',
65  'doktype',
66  'hidden',
67  'perms_everybody'
68  ],
69  'tt_content' => [
70  'CType',
71  'header',
72  'header_link',
73  'deleted',
74  'hidden',
75  't3ver_oid'
76  ],
77  'sys_file' => [
78  'storage',
79  'type',
80  'metadata',
81  'identifier',
82  'identifier_hash',
83  'folder_hash',
84  'mime_type',
85  'name',
86  'sha1',
87  'size',
88  'creation_date',
89  'modification_date',
90  ],
91  ]
92  );
93 
94  $subject->relOnlyTables = [
95  'sys_file',
96  ];
97 
98  // @todo: Do not rely on BackendUtility::getRecord() in the test case itself
99  $subject->export_addRecord('pages', $this->‪forceStringsOnRowValues(‪BackendUtility::getRecord('pages', 1)));
100  $subject->export_addRecord('pages', $this->‪forceStringsOnRowValues(‪BackendUtility::getRecord('pages', 2)));
101  $subject->export_addRecord('tt_content', $this->‪forceStringsOnRowValues(‪BackendUtility::getRecord('tt_content', 1)));
102  $subject->export_addRecord('tt_content', $this->‪forceStringsOnRowValues(‪BackendUtility::getRecord('tt_content', 2)));
103 
104  $this->‪setPageTree($subject, 1, 1);
105 
106  // After adding ALL records we set relations:
107  for ($a = 0; $a < 10; $a++) {
108  $addR = $subject->export_addDBRelations($a);
109  if (empty($addR)) {
110  break;
111  }
112  }
113 
114  $subject->export_addFilesFromRelations();
115  $subject->export_addFilesFromSysFilesRecords();
116 
117  $out = $subject->compileMemoryToFileContent('xml');
118 
119  self::assertXmlStringEqualsXmlFile(
120  __DIR__ . '/../Fixtures/XmlExports/pages-and-ttcontent.xml',
121  $out
122  );
123  }
124 }
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: PagesAndTtContentTest.php:36
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest\$pathsToLinkInTestInstance
‪array $pathsToLinkInTestInstance
Definition: PagesAndTtContentTest.php:30
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest\setUp
‪setUp()
Definition: PagesAndTtContentTest.php:40
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest
Definition: PagesAndTtContentTest.php:27
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase\setPageTree
‪setPageTree(Export $export, $pidToStart, $depth=1)
Definition: AbstractImportExportTestCase.php:81
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecord
‪static array null getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)
Definition: BackendUtility.php:95
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentTest\exportPagesAndRelatedTtContent
‪exportPagesAndRelatedTtContent()
Definition: PagesAndTtContentTest.php:53
‪TYPO3\CMS\Impexp\Tests\Functional\Export
Definition: ExportControllerTest.php:18
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase
Definition: AbstractImportExportTestCase.php:31
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase\forceStringsOnRowValues
‪array forceStringsOnRowValues(array $row)
Definition: AbstractImportExportTestCase.php:157
‪TYPO3\CMS\Impexp\Export
Definition: Export.php:64
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46