TYPO3 CMS  TYPO3_7-6
ExportTest.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 
18 
23 {
27  protected $testExtensionsToLoad = [
28  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial',
29  ];
30 
31  protected function setUp()
32  {
33  parent::setUp();
34 
35  $this->importDataSet(__DIR__ . '/../../Fixtures/Database/irre_tutorial.xml');
36  }
37 
41  public function exportIrreRecords()
42  {
43  $recordTypesIncludeFields = [
44  'pages' => [
45  'title',
46  'deleted',
47  'doktype',
48  'hidden',
49  'perms_everybody'
50  ],
51  'tt_content' => [
52  'CType',
53  'header',
54  'deleted',
55  'hidden',
56  't3ver_oid',
57  'tx_irretutorial_1nff_hotels',
58  'tx_irretutorial_1ncsv_hotels'
59  ],
60  'tx_irretutorial_1ncsv_hotel' => [
61  'cruser_id',
62  'sys_language_uid',
63  'l18n_parent',
64  'sorting',
65  'deleted',
66  'hidden',
67  'title',
68  'offers',
69  ],
70  'tx_irretutorial_1ncsv_offer' => [
71  'cruser_id',
72  'sys_language_uid',
73  'l18n_parent',
74  'sorting',
75  'deleted',
76  'hidden',
77  'title',
78  'prices',
79  ],
80  'tx_irretutorial_1ncsv_price' => [
81  'cruser_id',
82  'sys_language_uid',
83  'l18n_parent',
84  'sorting',
85  'deleted',
86  'hidden',
87  'title',
88  'price',
89  ],
90  'tx_irretutorial_1nff_hotel' => [
91  'cruser_id',
92  'sys_language_uid',
93  'l18n_parent',
94  'sorting',
95  'deleted',
96  'hidden',
97  'parentid',
98  'parenttable',
99  'parentidentifier',
100  'title',
101  'offers',
102  ],
103  'tx_irretutorial_1nff_offer' => [
104  'cruser_id',
105  'sys_language_uid',
106  'l18n_parent',
107  'sorting',
108  'deleted',
109  'hidden',
110  'parentid',
111  'parenttable',
112  'parentidentifier',
113  'title',
114  'prices',
115  ],
116  'tx_irretutorial_1nff_price' => [
117  'cruser_id',
118  'sys_language_uid',
119  'l18n_parent',
120  'sorting',
121  'deleted',
122  'hidden',
123  'parentid',
124  'parenttable',
125  'parentidentifier',
126  'title',
127  'price',
128  ],
129  'tx_irretutorial_mnasym_hotel' => [
130  'cruser_id',
131  'sys_language_uid',
132  'l18n_parent',
133  'sorting',
134  'deleted',
135  'hidden',
136  'title',
137  'offers',
138  ],
139  'tx_irretutorial_mnasym_hotel_offer_rel' => [
140  'cruser_id',
141  'sys_language_uid',
142  'l18n_parent',
143  'deleted',
144  'hidden',
145  'hotelid',
146  'offerid',
147  'hotelsort',
148  'offersort',
149  'prices',
150  ],
151  'tx_irretutorial_mnasym_offer' => [
152  'cruser_id',
153  'sys_language_uid',
154  'l18n_parent',
155  'sorting',
156  'deleted',
157  'hidden',
158  'title',
159  'hotels',
160  ],
161  'tx_irretutorial_mnasym_price' => [
162  'cruser_id',
163  'sys_language_uid',
164  'l18n_parent',
165  'sorting',
166  'deleted',
167  'hidden',
168  'parentid',
169  'title',
170  'price',
171  ],
172  'tx_irretutorial_mnattr_hotel' => [
173  'cruser_id',
174  'sys_language_uid',
175  'l18n_parent',
176  'sorting',
177  'deleted',
178  'hidden',
179  'title',
180  'offers',
181  ],
182  'tx_irretutorial_mnattr_hotel_offer_rel' => [
183  'cruser_id',
184  'sys_language_uid',
185  'l18n_parent',
186  'deleted',
187  'hidden',
188  'hotelid',
189  'offerid',
190  'hotelsort',
191  'offersort',
192  'quality',
193  'allincl',
194  ],
195  'tx_irretutorial_mnattr_offer' => [
196  'cruser_id',
197  'sys_language_uid',
198  'l18n_parent',
199  'sorting',
200  'deleted',
201  'hidden',
202  'title',
203  'hotels',
204  ],
205  'tx_irretutorial_mnmmasym_hotel' => [
206  'cruser_id',
207  'sys_language_uid',
208  'l18n_parent',
209  'sorting',
210  'deleted',
211  'hidden',
212  'title',
213  'offers',
214  ],
215  'tx_irretutorial_mnmmasym_hotel_offer_rel' => [
216  'uid_local',
217  'uid_foreign',
218  'tablenames',
219  'sorting',
220  'sorting_foreign',
221  'ident',
222  ],
223  'tx_irretutorial_mnmmasym_offer' => [
224  'cruser_id',
225  'sys_language_uid',
226  'l18n_parent',
227  'sorting',
228  'deleted',
229  'hidden',
230  'title',
231  'hotels',
232  'prices',
233  ],
234  'tx_irretutorial_mnmmasym_offer_price_rel' => [
235  'uid_local',
236  'uid_foreign',
237  'tablenames',
238  'sorting',
239  'sorting_foreign',
240  'ident',
241  ],
242  'tx_irretutorial_mnmmasym_price' => [
243  'cruser_id',
244  'sys_language_uid',
245  'l18n_parent',
246  'sorting',
247  'deleted',
248  'hidden',
249  'title',
250  'price',
251  'offers',
252  ],
253  'tx_irretutorial_mnsym_hotel' => [
254  'cruser_id',
255  'sys_language_uid',
256  'l18n_parent',
257  'sorting',
258  'deleted',
259  'hidden',
260  'title',
261  'branches',
262  ],
263  'tx_irretutorial_mnsym_hotel_rel' => [
264  'cruser_id',
265  'sys_language_uid',
266  'l18n_parent',
267  'deleted',
268  'hidden',
269  'hotelid',
270  'branchid',
271  'hotelsort',
272  'branchsort',
273  ]
274 
275  ];
276 
277  $this->export->setRecordTypesIncludeFields($recordTypesIncludeFields);
278 
279  $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 1));
280  $this->addRecordsForPid(1, array_keys($recordTypesIncludeFields));
281 
282  $this->setPageTree(1);
283 
284  // After adding ALL records we set relations:
285  for ($a = 0; $a < 10; $a++) {
286  $addR = $this->export->export_addDBRelations($a);
287  if (empty($addR)) {
288  break;
289  }
290  }
291 
292  $this->export->export_addFilesFromRelations();
293  $this->export->export_addFilesFromSysFilesRecords();
294 
295  $out = $this->export->compileMemoryToFileContent('xml');
296 
297  $this->assertXmlStringEqualsXmlFile(__DIR__ . '/../../Fixtures/ImportExportXml/irre-records.xml', $out);
298  }
299 }
static getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)