[TASK] Use DataHandler testing framework for simple import test 25/27325/3
authorMarc Bastian Heinrichs <typo3@mbh-software.de>
Tue, 4 Feb 2014 17:10:28 +0000 (18:10 +0100)
committerMarc Bastian Heinrichs <typo3@mbh-software.de>
Tue, 25 Feb 2014 10:36:13 +0000 (11:36 +0100)
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
typo3/sysext/impexp/Tests/Functional/Import/AbstractImportTestCase.php [new file with mode: 0644]
typo3/sysext/impexp/Tests/Functional/Import/PagesAndTtContent/DataSet/Assertion/importSimplePagesAndRelatedTtContent.csv [new file with mode: 0644]
typo3/sysext/impexp/Tests/Functional/Import/PagesAndTtContent/ImportInEmptyDatabaseTest.php [new file with mode: 0644]
typo3/sysext/impexp/Tests/Functional/ImportExport/ImportSimpleTest.php [deleted file]

diff --git a/typo3/sysext/impexp/Tests/Functional/Import/AbstractImportTestCase.php b/typo3/sysext/impexp/Tests/Functional/Import/AbstractImportTestCase.php
new file mode 100644 (file)
index 0000000..f6fc9b8
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+namespace TYPO3\CMS\Impexp\Tests\Functional\Import;
+
+/***************************************************************
+ * 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__ . '/../../../../core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php';
+
+/**
+ * Functional test for the ImportExport
+ */
+abstract class AbstractImportTestCase extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase {
+
+       /**
+        * @var array
+        */
+       protected $coreExtensionsToLoad = array('impexp');
+
+       /**
+        * @var \TYPO3\CMS\Impexp\ImportExport
+        */
+       protected $import;
+
+       /**
+        * Set up for set up the backend user, initialize the language object
+        * and creating the ImportExport instance
+        *
+        * @return void
+        */
+       public function setUp() {
+               parent::setUp();
+
+               $this->import = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Impexp\\ImportExport');
+               $this->import->init(0, 'import');
+       }
+
+}
\ No newline at end of file
diff --git a/typo3/sysext/impexp/Tests/Functional/Import/PagesAndTtContent/DataSet/Assertion/importSimplePagesAndRelatedTtContent.csv b/typo3/sysext/impexp/Tests/Functional/Import/PagesAndTtContent/DataSet/Assertion/importSimplePagesAndRelatedTtContent.csv
new file mode 100644 (file)
index 0000000..6014a7a
--- /dev/null
@@ -0,0 +1,7 @@
+"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
diff --git a/typo3/sysext/impexp/Tests/Functional/Import/PagesAndTtContent/ImportInEmptyDatabaseTest.php b/typo3/sysext/impexp/Tests/Functional/Import/PagesAndTtContent/ImportInEmptyDatabaseTest.php
new file mode 100644 (file)
index 0000000..3cb2e86
--- /dev/null
@@ -0,0 +1,47 @@
+<?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
diff --git a/typo3/sysext/impexp/Tests/Functional/ImportExport/ImportSimpleTest.php b/typo3/sysext/impexp/Tests/Functional/ImportExport/ImportSimpleTest.php
deleted file mode 100644 (file)
index 995a721..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-namespace TYPO3\CMS\Impexp\Tests\Functional\ImportExport;
-
-/***************************************************************
- * 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!
- ***************************************************************/
-
-
-/**
- * Functional test for the ImportExport
- */
-class ImportSimpleTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
-
-       /**
-        * @var array
-        */
-       protected $coreExtensionsToLoad = array('impexp');
-
-       public function setUp() {
-               parent::setUp();
-               $this->setUpBackendUserFromFixture(1);
-               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
-       }
-
-       /**
-        * @test
-        */
-       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();
-
-               $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']);
-
-               $row = $database->exec_SELECTgetSingleRow('*', 'tt_content', 'uid = 1');
-               $this->assertNotEmpty($row);
-               $this->assertEquals(1, $row['pid']);
-               $this->assertEquals('Test content', $row['header']);
-       }
-
-}
\ No newline at end of file