wiki.techinc.nl/tests/phpunit/includes/upload/UploadStashTest.php
Platonides f5dec1eefa Revert r90483, if tesla has problems, it should get proper permissions to the affected folders (or change the test to use a temp folder)
The test was not consistent, since first time it would use the svn file, which renames it... and on next run it would be missing!
I added the '.' to the unlik() step so it properly cleans up. Opened bug 29512 for the strange UploadStash behavior.

However, although it passes now most of the times, it sometimes fails with the strange exception:
Only variables should be passed by reference

phase3/includes/upload/UploadStash.php:143
phase3/tests/phpunit/includes/upload/UploadStashTest.php:22
phase3/tests/phpunit/MediaWikiTestCase.php:64
phase3/tests/phpunit/MediaWikiPHPUnitCommand.php:20
phase3/tests/phpunit/phpunit.php:60
2011-06-21 15:06:59 +00:00

35 lines
846 B
PHP

<?php
class UploadStashTest extends MediaWikiTestCase {
public function setUp() {
parent::setUp();
// Setup a fake session if necessary
if ( !isset( $_SESSION ) ) {
$GLOBALS['_SESSION'] = array();
}
// Setup a file for bug 29408
$this->bug29408File = dirname( __FILE__ ) . '/bug29408';
file_put_contents( $this->bug29408File, "\x00" );
}
public function testBug29408() {
$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' );
$file->remove();
}
public function tearDown() {
parent::tearDown();
unlink( $this->bug29408File . "." );
}
}