Cleaned up test cleanup for FileBackend and avoid use of @.
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 17 Apr 2013 18:20:50 +0000 (11:20 -0700)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 18 Apr 2013 05:43:51 +0000 (05:43 +0000)
Change-Id: Ie9f0090f626384a90b0139b9f8c2d94bf0bb8f23

tests/phpunit/includes/filebackend/FileBackendTest.php

index a73ccf0..3991c93 100644 (file)
@@ -892,6 +892,7 @@ class FileBackendTest extends MediaWikiTestCase {
                $this->backend = $this->singleBackend;
                $this->tearDownFiles();
                $this->doTestConcatenate( $op, $srcs, $srcsContent, $alreadyExists, $okStatus );
+               $this->filesToPrune[] = $op['dst']; # avoid file leaking
                $this->tearDownFiles();
 
                $this->backend = $this->multiBackend;
@@ -2196,7 +2197,9 @@ class FileBackendTest extends MediaWikiTestCase {
 
        function tearDownFiles() {
                foreach ( $this->filesToPrune as $file ) {
-                       @unlink( $file );
+                       if ( is_file( $file ) ) {
+                               unlink( $file );
+                       }
                }
                $containers = array( 'unittest-cont1', 'unittest-cont2' );
                foreach ( $containers as $container ) {