summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/upload/UploadStashTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /tests/phpunit/includes/upload/UploadStashTest.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'tests/phpunit/includes/upload/UploadStashTest.php')
-rw-r--r--tests/phpunit/includes/upload/UploadStashTest.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/phpunit/includes/upload/UploadStashTest.php b/tests/phpunit/includes/upload/UploadStashTest.php
new file mode 100644
index 00000000..9c39bc61
--- /dev/null
+++ b/tests/phpunit/includes/upload/UploadStashTest.php
@@ -0,0 +1,53 @@
+<?php
+
+class UploadStashTest extends MediaWikiTestCase {
+ /**
+ * @var Array of UploadStashTestUser
+ */
+ public static $users;
+
+ public function setUp() {
+ parent::setUp();
+
+ // Setup a file for bug 29408
+ $this->bug29408File = dirname( __FILE__ ) . '/bug29408';
+ file_put_contents( $this->bug29408File, "\x00" );
+
+ self::$users = array(
+ 'sysop' => new ApiTestUser(
+ 'Uploadstashtestsysop',
+ 'Upload Stash Test Sysop',
+ 'upload_stash_test_sysop@sample.com',
+ array( 'sysop' )
+ ),
+ 'uploader' => new ApiTestUser(
+ 'Uploadstashtestuser',
+ 'Upload Stash Test User',
+ 'upload_stash_test_user@sample.com',
+ array()
+ )
+ );
+ }
+
+ public function testBug29408() {
+ global $wgUser;
+ $wgUser = self::$users['uploader']->user;
+
+ $repo = RepoGroup::singleton()->getLocalRepo();
+ $stash = new UploadStash( $repo );
+
+ // Throws exception caught by PHPUnit on failure
+ $file = $stash->stashFile( $this->bug29408File );
+ // We'll never reach this point if we hit bug 29408
+ $this->assertTrue( true, 'Unrecognized file without extension' );
+
+ $stash->removeFile( $file->getFileKey() );
+ }
+
+ public function tearDown() {
+ parent::tearDown();
+
+ unlink( $this->bug29408File . "." );
+
+ }
+}