From a4eb5c9a8a3913b13ae2735d44aec5adb9d5731b Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 6 Nov 2017 22:45:34 -0800 Subject: [PATCH] upload: Simplify UploadStashTest by using getNewTempFile() The parent class has a built-in list that tracks these files and deletes them in a teardown. I was unable to reproduce a case where $path + '.' is created by MediaWiki. As far as I can tell, no current code exists in core that would do this. If it does exist, we can keep the tearDown() override with just that second case, but I'm removing it for now, given it doesn't appear to be used. Change-Id: I5847b7b266f1393d983aeb4b115bc0ae000e3547 --- tests/phpunit/includes/upload/UploadStashTest.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/tests/phpunit/includes/upload/UploadStashTest.php b/tests/phpunit/includes/upload/UploadStashTest.php index d754ba5a22..f46ad20646 100644 --- a/tests/phpunit/includes/upload/UploadStashTest.php +++ b/tests/phpunit/includes/upload/UploadStashTest.php @@ -19,7 +19,7 @@ class UploadStashTest extends MediaWikiTestCase { protected function setUp() { parent::setUp(); - $this->tmpFile = wfTempDir() . '/' . uniqid(); + $this->tmpFile = $this->getNewTempFile(); file_put_contents( $this->tmpFile, "\x00" ); self::$users = [ @@ -38,18 +38,6 @@ class UploadStashTest extends MediaWikiTestCase { ]; } - protected function tearDown() { - if ( file_exists( $this->tmpFile . "." ) ) { - unlink( $this->tmpFile . "." ); - } - - if ( file_exists( $this->tmpFile ) ) { - unlink( $this->tmpFile ); - } - - parent::tearDown(); - } - /** * @todo give this test a real name explaining what is being tested here */ -- 2.20.1