<?php

class UploadStashTest extends MediaWikiTestCase {
	public function setUp() {
		parent::setUp();
		
		// Setup a session
		wfSuppressWarnings();
		session_start();
		wfRestoreWarnings();
		
	}
	
	public function testImproperKey() {
		$path = dirname( __FILE__ ) . '/bug29408';
		file_put_contents( $path, "\x00" );
		
		$repo = RepoGroup::singleton()->getLocalRepo();
		$stash = new UploadStash( $repo );
		
		// Throws exception caught by PHPUnit on failure
		$file = $stash->stashFile( $path );
		$this->assertTrue( true, 'Unrecognized file without extension' );
		
		$file->remove();
		unlink( $path );
	}
	
	public function tearDown() {
		parent::tearDown();
		
	}
}