avoid exif tests file leakage

Exif test are leaking files heavily on our test server. This quick patch make
it sure we delete temporary files.

Ideally, we should have something like a temporary filesystem backend that
would self destruct :-D

requires r112326: wfRecursiveRemoveDir()
This commit is contained in:
Antoine Musso 2012-02-24 15:43:11 +00:00
parent 6e7dfac65a
commit f5b45904e1

View file

@ -5,11 +5,17 @@
*/
class ExifRotationTest extends MediaWikiTestCase {
/** track directories creations. Content will be deleted. */
private $createdDirs = array();
function setUp() {
parent::setUp();
$this->handler = new BitmapHandler();
$filePath = dirname( __FILE__ ) . '/../../data/media';
$tmpDir = wfTempDir() . '/exif-test-' . time() . '-' . mt_rand();
$this->createdDirs[] = $tmpDir;
$this->repo = new FSRepo( array(
'name' => 'temp',
'url' => 'http://localhost/thumbtest',
@ -30,10 +36,23 @@ class ExifRotationTest extends MediaWikiTestCase {
$this->oldAuto = $wgEnableAutoRotation;
$wgEnableAutoRotation = true;
}
public function tearDown() {
global $wgShowEXIF, $wgEnableAutoRotation;
$wgShowEXIF = $this->show;
$wgEnableAutoRotation = $this->oldAuto;
$this->tearDownFiles();
}
private function tearDownFiles() {
foreach( $this->createdDirs as $dir ) {
wfRecursiveRemoveDir( $dir );
}
}
function __destruct() {
$this->tearDownFiles();
}
/**