[TASK] FollowUp to add support for having files outside the t3d/xml 55/30955/3
authorMarc Bastian Heinrichs <typo3@mbh-software.de>
Fri, 20 Jun 2014 17:06:36 +0000 (19:06 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 20 Jun 2014 19:34:13 +0000 (21:34 +0200)
Fix functional tests.

Resolves: #57379
Change-Id: Iafbf4e2b7e68dd27b488f20141f34680f57bc9c4
Reviewed-on: https://review.typo3.org/30955
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/impexp/Tests/Functional/Import/AbstractImportTestCase.php
typo3/sysext/impexp/Tests/Functional/Import/GroupFileAndFileReferenceItem/ImportInEmptyDatabaseTest.php

index 2953267..d648eb8 100644 (file)
@@ -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
index 9ccecf3..1a0c9b2 100644 (file)
@@ -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