995a72141e350a4cd4b140e51bda1bc6b5c71ac0
[Packages/TYPO3.CMS.git] / typo3 / sysext / impexp / Tests / Functional / ImportExport / ImportSimpleTest.php
1 <?php
2 namespace TYPO3\CMS\Impexp\Tests\Functional\ImportExport;
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
28 /**
29 * Functional test for the ImportExport
30 */
31 class ImportSimpleTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
32
33 /**
34 * @var array
35 */
36 protected $coreExtensionsToLoad = array('impexp');
37
38 public function setUp() {
39 parent::setUp();
40 $this->setUpBackendUserFromFixture(1);
41 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
42 }
43
44 /**
45 * @test
46 */
47 public function canImportSimplePagesAndRelatedTtContent() {
48 /** @var $import \TYPO3\CMS\Impexp\ImportExport */
49 $import = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Impexp\\ImportExport');
50 $import->init(0, 'import');
51 $import->loadFile(__DIR__ . '/../Fixtures/ImportExport/pages-and-ttcontent.xml', 1);
52 $import->importData(0);
53
54 $database = $this->getDatabase();
55
56 $row = $database->exec_SELECTgetSingleRow('*', 'pages', 'uid = 1');
57 $this->assertNotEmpty($row);
58 $this->assertEquals(0, $row['pid']);
59 $this->assertEquals('Root', $row['title']);
60
61 $row = $database->exec_SELECTgetSingleRow('*', 'pages', 'uid = 2');
62 $this->assertNotEmpty($row);
63 $this->assertEquals(1, $row['pid']);
64 $this->assertEquals('Dummy 1-2', $row['title']);
65
66 $row = $database->exec_SELECTgetSingleRow('*', 'tt_content', 'uid = 1');
67 $this->assertNotEmpty($row);
68 $this->assertEquals(1, $row['pid']);
69 $this->assertEquals('Test content', $row['header']);
70 }
71
72 }