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