clean some files when testing upload
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiTestCaseUpload.php
index e51e721..3d57946 100644 (file)
@@ -19,6 +19,10 @@ abstract class ApiTestCaseUpload extends ApiTestCase {
                $this->clearFakeUploads();
        }
 
+       public function tearDown() {
+               $this->clearTempUpload();
+       }
+
        /**
         * Helper function -- remove files and associated articles by Title
         * @param $title Title: title to be removed
@@ -101,6 +105,15 @@ abstract class ApiTestCaseUpload extends ApiTestCase {
 
        }
 
+       function clearTempUpload() {
+               if( isset( $_FILES['file']['tmp_name'] ) ) {
+                       $tmp = $_FILES['file']['tmp_name'];
+                       if( file_exists( $tmp ) ) {
+                               unlink( $tmp );
+                       }
+               }
+       }
+
        /**
         * Remove traces of previous fake uploads
         */