‪TYPO3CMS  11.5
PagesAndTtContentWithRelationsAndSoftrefsTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 
24 {
26  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload' => 'fileadmin/user_upload',
27  'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/form_definitions' => 'fileadmin/form_definitions',
28  ];
29 
30  protected array ‪$recordTypesIncludeFields =
31  [
32  'pages' => [
33  'title',
34  'deleted',
35  'doktype',
36  'hidden',
37  'perms_everybody',
38  ],
39  'tt_content' => [
40  'CType',
41  'header',
42  'header_link',
43  'list_type',
44  'pi_flexform',
45  'deleted',
46  'hidden',
47  't3ver_oid',
48  ],
49  'sys_file' => [
50  'storage',
51  'type',
52  'metadata',
53  'identifier',
54  'identifier_hash',
55  'folder_hash',
56  'mime_type',
57  'name',
58  'sha1',
59  'size',
60  'creation_date',
61  'modification_date',
62  ],
63  ]
64  ;
65 
70  {
71  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/pages.csv');
72  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/tt_content-with-flexform-relation.csv');
73 
74  ‪$GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['default'] = '
75 <T3DataStructure>
76  <ROOT>
77  <type>array</type>
78  <el>
79  <flexFormRelation>
80  <TCEforms>
81  <label>FlexForm relation</label>
82  <config>
83  <type>group</type>
84  <allowed>pages</allowed>
85  <size>1</size>
86  <maxitems>1</maxitems>
87  <minitems>0</minitems>
88  </config>
89  </TCEforms>
90  </flexFormRelation>
91  </el>
92  </ROOT>
93 </T3DataStructure>';
94 
95  $subject = $this->getAccessibleMock(Export::class, ['setMetaData']);
96  $subject->setPid(1);
97  $subject->setLevels(1);
98  $subject->setTables(['tt_content']);
99  $subject->setRelOnlyTables(['pages']);
100  $subject->setRecordTypesIncludeFields($this->recordTypesIncludeFields);
101  $subject->process();
102 
103  $out = $subject->render();
104 
105  // @todo Use self::assertXmlStringEqualsXmlFile() instead when sqlite issue is sorted out
107  __DIR__ . '/../Fixtures/XmlExports/pages-and-ttcontent-with-flexform-relation.xml',
108  $out
109  );
110  }
111 
116  {
117  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/pages.csv');
118  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/tt_content-with-softrefs.csv');
119  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file.csv');
120 
121  ‪$GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['default'] = '
122 <T3DataStructure>
123  <ROOT>
124  <type>array</type>
125  <el>
126  <softrefLink>
127  <TCEforms>
128  <label>Soft reference link</label>
129  <config>
130  <type>input</type>
131  <renderType>inputLink</renderType>
132  <softref>typolink</softref>
133  <fieldControl>
134  <linkPopup>
135  <options>
136  <title>Link</title>
137  <blindLinkOptions>mail,folder,spec</blindLinkOptions>
138  <windowOpenParameters>height=300,width=500,status=0,menubar=0,scrollbars=1</windowOpenParameters>
139  </options>
140  </linkPopup>
141  </fieldControl>
142  </config>
143  </TCEforms>
144  </softrefLink>
145  </el>
146  </ROOT>
147 </T3DataStructure>';
148 
149  $subject = $this->getAccessibleMock(Export::class, ['setMetaData']);
150  $subject->setPid(1);
151  $subject->setLevels(1);
152  $subject->setTables(['_ALL']);
153  $subject->setRelOnlyTables(['sys_file']);
154  $subject->setRecordTypesIncludeFields($this->recordTypesIncludeFields);
155  $subject->process();
156 
157  $out = $subject->render();
158 
159  // @todo Use self::assertXmlStringEqualsXmlFile() instead when sqlite issue is sorted out
161  __DIR__ . '/../Fixtures/XmlExports/pages-and-ttcontent-with-softrefs.xml',
162  $out
163  );
164  }
165 
170  {
171  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/pages.csv');
172  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/tt_content-with-flexform-softrefs.csv');
173  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/form_sys_file.csv');
174 
175  ‪$GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['default'] = '
176 <T3DataStructure>
177  <sheets>
178  <sDEF>
179  <ROOT>
180  <TCEforms>
181  <sheetTitle>LLL:EXT:form/Resources/Private/Language/Database.xlf:tt_content.pi_flexform.formframework.sheet_general</sheetTitle>
182  </TCEforms>
183  <type>array</type>
184  <el>
185  <settings.persistenceIdentifier>
186  <TCEforms>
187  <label>LLL:EXT:form/Resources/Private/Language/Database.xlf:tt_content.pi_flexform.formframework.persistenceIdentifier</label>
188  <onChange>reload</onChange>
189  <config>
190  <type>select</type>
191  <renderType>selectSingle</renderType>
192  <items>
193  <numIndex index="0" type="array">
194  <numIndex index="0">LLL:EXT:form/Resources/Private/Language/Database.xlf:tt_content.pi_flexform.formframework.selectPersistenceIdentifier</numIndex>
195  <numIndex index="1"></numIndex>
196  </numIndex>
197  </items>
198  <softref>formPersistenceIdentifier</softref>
199  </config>
200  </TCEforms>
201  </settings.persistenceIdentifier>
202  </el>
203  </ROOT>
204  </sDEF>
205  </sheets>
206 </T3DataStructure>';
207 
208  $subject = $this->getAccessibleMock(Export::class, ['setMetaData']);
209  $subject->setPid(1);
210  $subject->setLevels(1);
211  $subject->setTables(['_ALL']);
212  $subject->setRelOnlyTables(['sys_file']);
213  $subject->setRecordTypesIncludeFields($this->recordTypesIncludeFields);
214  $subject->process();
215 
216  $out = $subject->render();
217 
218  // @todo Use self::assertXmlStringEqualsXmlFile() instead when sqlite issue is sorted out
220  __DIR__ . '/../Fixtures/XmlExports/pages-and-ttcontent-with-flexform-softrefs.xml',
221  $out
222  );
223  }
224 }
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentWithRelationsAndSoftrefsTest\exportPagesAndRelatedTtContentWithSoftrefs
‪exportPagesAndRelatedTtContentWithSoftrefs()
Definition: PagesAndTtContentWithRelationsAndSoftrefsTest.php:115
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase\assertXmlStringEqualsXmlFileWithIgnoredSqliteTypeInteger
‪assertXmlStringEqualsXmlFileWithIgnoredSqliteTypeInteger(string $expectedFile, string $actualXml)
Definition: AbstractImportExportTestCase.php:105
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentWithRelationsAndSoftrefsTest\exportPagesAndRelatedTtContentWithFlexFormRelation
‪exportPagesAndRelatedTtContentWithFlexFormRelation()
Definition: PagesAndTtContentWithRelationsAndSoftrefsTest.php:69
‪TYPO3\CMS\Impexp\Tests\Functional\Export
Definition: ExportControllerTest.php:18
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase
Definition: AbstractImportExportTestCase.php:34
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Impexp\Export
Definition: Export.php:48
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentWithRelationsAndSoftrefsTest\$recordTypesIncludeFields
‪array $recordTypesIncludeFields
Definition: PagesAndTtContentWithRelationsAndSoftrefsTest.php:30
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentWithRelationsAndSoftrefsTest\exportPagesAndRelatedTtContentWithFlexFormSoftrefs
‪exportPagesAndRelatedTtContentWithFlexFormSoftrefs()
Definition: PagesAndTtContentWithRelationsAndSoftrefsTest.php:169
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentWithRelationsAndSoftrefsTest\$pathsToLinkInTestInstance
‪$pathsToLinkInTestInstance
Definition: PagesAndTtContentWithRelationsAndSoftrefsTest.php:25
‪TYPO3\CMS\Impexp\Tests\Functional\Export\PagesAndTtContentWithRelationsAndSoftrefsTest
Definition: PagesAndTtContentWithRelationsAndSoftrefsTest.php:24