From: Antoine Musso Date: Thu, 8 Dec 2011 14:03:04 +0000 (+0000) Subject: clean some files when testing upload X-Git-Tag: 1.31.0-rc.0~26130 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=67aebdd165219e837ea779ddb7abf19f2d075a63;p=lhc%2Fweb%2Fwiklou.git clean some files when testing upload This catch temporary uploaded files which are six characters long. Follow-up r102458 --- diff --git a/tests/phpunit/includes/api/ApiTestCaseUpload.php b/tests/phpunit/includes/api/ApiTestCaseUpload.php index e51e72140a..3d57946072 100644 --- a/tests/phpunit/includes/api/ApiTestCaseUpload.php +++ b/tests/phpunit/includes/api/ApiTestCaseUpload.php @@ -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 */