[TASK] Add functional tests for impexp irre records
[Packages/TYPO3.CMS.git] / typo3 / sysext / impexp / Tests / Functional / Export / IrreTutorialRecords / ExportTest.php
1 <?php
2 namespace TYPO3\CMS\Impexp\Tests\Functional\Export\IrreTutorialRecords;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2014 Marc Bastian Heinrichs <typo3@mbh-software.de>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 use TYPO3\CMS\Backend\Utility\BackendUtility;
28
29 require_once __DIR__ . '/../AbstractExportTestCase.php';
30
31 /**
32 * Functional test for the ImportExport
33 */
34 class ExportTest extends \TYPO3\CMS\Impexp\Tests\Functional\Export\AbstractExportTestCase {
35
36 /**
37 * @var array
38 */
39 protected $testExtensionsToLoad = array(
40 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial',
41 );
42
43 public function setUp() {
44 parent::setUp();
45
46 $this->importDataSet(__DIR__ . '/../../Fixtures/Database/irre_tutorial.xml');
47 }
48
49 /**
50 * @test
51 */
52 public function exportIrreRecords() {
53
54 $recordTypesIncludeFields = array(
55 'pages' => array(
56 'title',
57 'deleted',
58 'doktype',
59 'hidden',
60 'perms_everybody'
61 ),
62 'tt_content' => array(
63 'CType',
64 'header',
65 'deleted',
66 'hidden',
67 't3ver_oid',
68 'tx_irretutorial_1nff_hotels',
69 'tx_irretutorial_1ncsv_hotels'
70 ),
71 'tx_irretutorial_1ncsv_hotel' => array(
72 'cruser_id',
73 'sys_language_uid',
74 'l18n_parent',
75 'sorting',
76 'deleted',
77 'hidden',
78 'title',
79 'offers',
80 ),
81 'tx_irretutorial_1ncsv_offer' => array(
82 'cruser_id',
83 'sys_language_uid',
84 'l18n_parent',
85 'sorting',
86 'deleted',
87 'hidden',
88 'title',
89 'prices',
90 ),
91 'tx_irretutorial_1ncsv_price' => array(
92 'cruser_id',
93 'sys_language_uid',
94 'l18n_parent',
95 'sorting',
96 'deleted',
97 'hidden',
98 'title',
99 'price',
100 ),
101 'tx_irretutorial_1nff_hotel' => array(
102 'cruser_id',
103 'sys_language_uid',
104 'l18n_parent',
105 'sorting',
106 'deleted',
107 'hidden',
108 'parentid',
109 'parenttable',
110 'parentidentifier',
111 'title',
112 'offers',
113 ),
114 'tx_irretutorial_1nff_offer' => array(
115 'cruser_id',
116 'sys_language_uid',
117 'l18n_parent',
118 'sorting',
119 'deleted',
120 'hidden',
121 'parentid',
122 'parenttable',
123 'parentidentifier',
124 'title',
125 'prices',
126 ),
127 'tx_irretutorial_1nff_price' => array(
128 'cruser_id',
129 'sys_language_uid',
130 'l18n_parent',
131 'sorting',
132 'deleted',
133 'hidden',
134 'parentid',
135 'parenttable',
136 'parentidentifier',
137 'title',
138 'price',
139 ),
140 'tx_irretutorial_mnasym_hotel' => array(
141 'cruser_id',
142 'sys_language_uid',
143 'l18n_parent',
144 'sorting',
145 'deleted',
146 'hidden',
147 'title',
148 'offers',
149 ),
150 'tx_irretutorial_mnasym_hotel_offer_rel' => array(
151 'cruser_id',
152 'sys_language_uid',
153 'l18n_parent',
154 'deleted',
155 'hidden',
156 'hotelid',
157 'offerid',
158 'hotelsort',
159 'offersort',
160 'prices',
161 ),
162 'tx_irretutorial_mnasym_offer' => array(
163 'cruser_id',
164 'sys_language_uid',
165 'l18n_parent',
166 'sorting',
167 'deleted',
168 'hidden',
169 'title',
170 'hotels',
171 ),
172 'tx_irretutorial_mnasym_price' => array(
173 'cruser_id',
174 'sys_language_uid',
175 'l18n_parent',
176 'sorting',
177 'deleted',
178 'hidden',
179 'parentid',
180 'title',
181 'price',
182 ),
183 'tx_irretutorial_mnattr_hotel' => array(
184 'cruser_id',
185 'sys_language_uid',
186 'l18n_parent',
187 'sorting',
188 'deleted',
189 'hidden',
190 'title',
191 'offers',
192 ),
193 'tx_irretutorial_mnattr_hotel_offer_rel' => array(
194 'cruser_id',
195 'sys_language_uid',
196 'l18n_parent',
197 'deleted',
198 'hidden',
199 'hotelid',
200 'offerid',
201 'hotelsort',
202 'offersort',
203 'quality',
204 'allincl',
205 ),
206 'tx_irretutorial_mnattr_offer' => array(
207 'cruser_id',
208 'sys_language_uid',
209 'l18n_parent',
210 'sorting',
211 'deleted',
212 'hidden',
213 'title',
214 'hotels',
215 ),
216 'tx_irretutorial_mnmmasym_hotel' => array(
217 'cruser_id',
218 'sys_language_uid',
219 'l18n_parent',
220 'sorting',
221 'deleted',
222 'hidden',
223 'title',
224 'offers',
225 ),
226 'tx_irretutorial_mnmmasym_hotel_offer_rel' => array(
227 'uid_local',
228 'uid_foreign',
229 'tablenames',
230 'sorting',
231 'sorting_foreign',
232 'ident',
233 ),
234 'tx_irretutorial_mnmmasym_offer' => array(
235 'cruser_id',
236 'sys_language_uid',
237 'l18n_parent',
238 'sorting',
239 'deleted',
240 'hidden',
241 'title',
242 'hotels',
243 'prices',
244 ),
245 'tx_irretutorial_mnmmasym_offer_price_rel' => array(
246 'uid_local',
247 'uid_foreign',
248 'tablenames',
249 'sorting',
250 'sorting_foreign',
251 'ident',
252 ),
253 'tx_irretutorial_mnmmasym_price' => array(
254 'cruser_id',
255 'sys_language_uid',
256 'l18n_parent',
257 'sorting',
258 'deleted',
259 'hidden',
260 'title',
261 'price',
262 'offers',
263 ),
264 'tx_irretutorial_mnsym_hotel' => array(
265 'cruser_id',
266 'sys_language_uid',
267 'l18n_parent',
268 'sorting',
269 'deleted',
270 'hidden',
271 'title',
272 'branches',
273 ),
274 'tx_irretutorial_mnsym_hotel_rel' => array(
275 'cruser_id',
276 'sys_language_uid',
277 'l18n_parent',
278 'deleted',
279 'hidden',
280 'hotelid',
281 'branchid',
282 'hotelsort',
283 'branchsort',
284 )
285
286 );
287
288 $this->export->setRecordTypesIncludeFields($recordTypesIncludeFields);
289
290 $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 1));
291 $this->addRecordsForPid(1, array_keys($recordTypesIncludeFields));
292
293 $this->setPageTree(1);
294
295 // After adding ALL records we set relations:
296 for ($a = 0; $a < 10; $a++) {
297 $addR = $this->export->export_addDBRelations($a);
298 if (!count($addR)) {
299 break;
300 }
301 }
302
303 $this->export->export_addFilesFromRelations();
304 $this->export->export_addFilesFromSysFilesRecords();
305
306 $out = $this->export->compileMemoryToFileContent('xml');
307
308 $this->assertXmlStringEqualsXmlFile(__DIR__ . '/../../Fixtures/ImportExport/irre-records.xml', $out);
309 }
310
311 }