Skip to content
Snippets Groups Projects
Commit aa43d8f8 authored by Marc Bastian Heinrichs's avatar Marc Bastian Heinrichs
Browse files

[TASK] Use DataHandler testing framework for simple import test

Adapt the impexp simple import test to the testing framework
available with #54855.

Resolves: #55664
Related: #54855
Releases: 6.2
Change-Id: I6f1e9eb6ef3bda5b984ac67af3964fed90ba41f2
Reviewed-on: https://review.typo3.org/27325
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
parent ad67e91d
No related merge requests found
<?php
namespace TYPO3\CMS\Impexp\Tests\Functional\ImportExport;
namespace TYPO3\CMS\Impexp\Tests\Functional\Import;
/***************************************************************
* Copyright notice
......@@ -24,49 +24,34 @@ namespace TYPO3\CMS\Impexp\Tests\Functional\ImportExport;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
require_once __DIR__ . '/../../../../core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php';
/**
* Functional test for the ImportExport
*/
class ImportSimpleTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
abstract class AbstractImportTestCase extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase {
/**
* @var array
*/
protected $coreExtensionsToLoad = array('impexp');
public function setUp() {
parent::setUp();
$this->setUpBackendUserFromFixture(1);
\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
}
/**
* @test
* @var \TYPO3\CMS\Impexp\ImportExport
*/
public function canImportSimplePagesAndRelatedTtContent() {
/** @var $import \TYPO3\CMS\Impexp\ImportExport */
$import = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Impexp\\ImportExport');
$import->init(0, 'import');
$import->loadFile(__DIR__ . '/../Fixtures/ImportExport/pages-and-ttcontent.xml', 1);
$import->importData(0);
$database = $this->getDatabase();
protected $import;
$row = $database->exec_SELECTgetSingleRow('*', 'pages', 'uid = 1');
$this->assertNotEmpty($row);
$this->assertEquals(0, $row['pid']);
$this->assertEquals('Root', $row['title']);
$row = $database->exec_SELECTgetSingleRow('*', 'pages', 'uid = 2');
$this->assertNotEmpty($row);
$this->assertEquals(1, $row['pid']);
$this->assertEquals('Dummy 1-2', $row['title']);
/**
* Set up for set up the backend user, initialize the language object
* and creating the ImportExport instance
*
* @return void
*/
public function setUp() {
parent::setUp();
$row = $database->exec_SELECTgetSingleRow('*', 'tt_content', 'uid = 1');
$this->assertNotEmpty($row);
$this->assertEquals(1, $row['pid']);
$this->assertEquals('Test content', $row['header']);
$this->import = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Impexp\\ImportExport');
$this->import->init(0, 'import');
}
}
\ No newline at end of file
"pages"
,"uid","pid","sorting","deleted","title"
,1,0,256,0,"Root"
,2,1,256,0,"Dummy 1-2"
"tt_content"
,"uid","pid","sorting","deleted","header"
,1,1,256,0,"Test content"
\ No newline at end of file
<?php
namespace TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContent;
/***************************************************************
* Copyright notice
*
* (c) 2014 Marc Bastian Heinrichs <typo3@mbh-software.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
require_once __DIR__ . '/../AbstractImportTestCase.php';
/**
* Functional test for the ImportExport
*/
class ImportInEmptyDatabaseTest extends \TYPO3\CMS\Impexp\Tests\Functional\Import\AbstractImportTestCase {
protected $dataSetDirectory = 'typo3/sysext/impexp/Tests/Functional/Import/PagesAndTtContent/DataSet/';
/**
* @test
*/
public function importSimplePagesAndRelatedTtContent() {
$this->import->loadFile(__DIR__ . '/../../Fixtures/ImportExport/pages-and-ttcontent.xml', 1);
$this->import->importData(0);
$this->assertAssertionDataSet('importSimplePagesAndRelatedTtContent');
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment