From 8a402d2a28d06e4f87a30f5b334c42c9dccb6bcc Mon Sep 17 00:00:00 2001
From: Marc Bastian Heinrichs <typo3@mbh-software.de>
Date: Fri, 20 Jun 2014 19:06:36 +0200
Subject: [PATCH] [TASK] FollowUp to add support for having files outside the
 t3d/xml

Fix functional tests.

Resolves: #57379
Change-Id: Iafbf4e2b7e68dd27b488f20141f34680f57bc9c4
Reviewed-on: https://review.typo3.org/30955
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
---
 .../Import/AbstractImportTestCase.php         | 22 +++++++++++++++++--
 .../ImportInEmptyDatabaseTest.php             |  7 ++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/impexp/Tests/Functional/Import/AbstractImportTestCase.php b/typo3/sysext/impexp/Tests/Functional/Import/AbstractImportTestCase.php
index 2953267031fc..d648eb8d14dd 100644
--- a/typo3/sysext/impexp/Tests/Functional/Import/AbstractImportTestCase.php
+++ b/typo3/sysext/impexp/Tests/Functional/Import/AbstractImportTestCase.php
@@ -44,8 +44,15 @@ abstract class AbstractImportTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
 	protected $import;
 
 	/**
-	 * Set up for set up the backend user, initialize the language object
-	 * and creating the ImportExport instance
+	 * Absolute path to files that must be removed
+	 * after a test - handled in tearDown
+	 *
+	 * @var array
+	 */
+	protected $testFilesToDelete = array();
+
+	/**
+	 * Set up for initialization of the ImportExport instance
 	 *
 	 * @return void
 	 */
@@ -56,6 +63,17 @@ abstract class AbstractImportTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
 		$this->import->init(0, 'import');
 	}
 
+	/**
+	 * Tear down for remove of the test files
+	 */
+	public function tearDown() {
+		foreach ($this->testFilesToDelete as $absoluteFileName) {
+			if (@is_file($absoluteFileName)) {
+				unlink($absoluteFileName);
+			}
+		}
+		parent::tearDown();
+	}
 
 	/**
 	 * Test if the local filesystem is case sensitive
diff --git a/typo3/sysext/impexp/Tests/Functional/Import/GroupFileAndFileReferenceItem/ImportInEmptyDatabaseTest.php b/typo3/sysext/impexp/Tests/Functional/Import/GroupFileAndFileReferenceItem/ImportInEmptyDatabaseTest.php
index 9ccecf3f72d5..1a0c9b2cbd11 100644
--- a/typo3/sysext/impexp/Tests/Functional/Import/GroupFileAndFileReferenceItem/ImportInEmptyDatabaseTest.php
+++ b/typo3/sysext/impexp/Tests/Functional/Import/GroupFileAndFileReferenceItem/ImportInEmptyDatabaseTest.php
@@ -61,6 +61,10 @@ class ImportInEmptyDatabaseTest extends \TYPO3\CMS\Impexp\Tests\Functional\Impor
 
 		$this->assertFileEquals(__DIR__ . '/../../Fixtures/Folders/fileadmin/user_upload/typo3_image5.jpg', PATH_site . 'fileadmin/user_upload/typo3_image5.jpg');
 		$this->assertFileEquals(__DIR__ . '/../../Fixtures/Folders/uploads/tx_impexpgroupfiles/typo3_image4.jpg', PATH_site . 'uploads/tx_impexpgroupfiles/typo3_image4.jpg');
+
+		$this->testFilesToDelete[] = PATH_site . 'fileadmin/user_upload/typo3_image5.jpg';
+		$this->testFilesToDelete[] = PATH_site . 'uploads/tx_impexpgroupfiles/typo3_image4.jpg';
+
 	}
 
 	/**
@@ -75,6 +79,9 @@ class ImportInEmptyDatabaseTest extends \TYPO3\CMS\Impexp\Tests\Functional\Impor
 
 		$this->assertFileEquals(__DIR__ . '/../../Fixtures/Folders/fileadmin/user_upload/typo3_image5.jpg', PATH_site . 'fileadmin/user_upload/typo3_image5.jpg');
 		$this->assertFileEquals(__DIR__ . '/../../Fixtures/Folders/uploads/tx_impexpgroupfiles/typo3_image4.jpg', PATH_site . 'uploads/tx_impexpgroupfiles/typo3_image4.jpg');
+
+		$this->testFilesToDelete[] = PATH_site . 'fileadmin/user_upload/typo3_image5.jpg';
+		$this->testFilesToDelete[] = PATH_site . 'uploads/tx_impexpgroupfiles/typo3_image4.jpg';
 	}
 
 }
\ No newline at end of file
-- 
GitLab