public $functionHooks = array();
public $transparentHooks = array();
- //Fuzz test
+ // Fuzz test
public $maxFuzzTestLength = 300;
public $fuzzSeed = 0;
public $memoryLimit = 50;
parent::setUp();
- //Setup CLI arguments
+ // Setup CLI arguments
if ( $this->getCliArg( 'regex' ) ) {
$this->regex = $this->getCliArg( 'regex' );
} else {
function addDBData() {
$this->tablesUsed[] = 'site_stats';
# disabled for performance
- #$this->tablesUsed[] = 'image';
+ # $this->tablesUsed[] = 'image';
# Update certain things in site_stats
$this->db->insert( 'site_stats',
'media_type' => MEDIATYPE_BITMAP,
'mime' => 'image/jpeg',
'metadata' => serialize( array() ),
- 'sha1' => wfBaseConvert( '1', 16, 36, 31 ),
+ 'sha1' => Wikimedia\base_convert( '1', 16, 36, 31 ),
'fileExists' => true ),
$this->db->timestamp( '20010115123500' ), $user
);
'media_type' => MEDIATYPE_BITMAP,
'mime' => 'image/png',
'metadata' => serialize( array() ),
- 'sha1' => wfBaseConvert( '2', 16, 36, 31 ),
+ 'sha1' => Wikimedia\base_convert( '2', 16, 36, 31 ),
'fileExists' => true ),
$this->db->timestamp( '20130225203040' ), $user
);
'media_type' => MEDIATYPE_BITMAP,
'mime' => 'image/jpeg',
'metadata' => serialize( array() ),
- 'sha1' => wfBaseConvert( '3', 16, 36, 31 ),
+ 'sha1' => Wikimedia\base_convert( '3', 16, 36, 31 ),
'fileExists' => true ),
$this->db->timestamp( '20010115123500' ), $user
);
'media_type' => MEDIATYPE_DRAWING,
'mime' => 'image/svg+xml',
'metadata' => serialize( array() ),
- 'sha1' => wfBaseConvert( '', 16, 36, 31 ),
+ 'sha1' => Wikimedia\base_convert( '', 16, 36, 31 ),
'fileExists' => true
), $this->db->timestamp( '20010115123500' ), $user );
}
+ $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Video.ogv' ) );
+ if ( !$this->db->selectField( 'image', '1', array( 'img_name' => $image->getName() ) ) ) {
+ $image->recordUpload2( '', 'A pretty movie', 'Will it play', array(
+ 'size' => 12345,
+ 'width' => 240,
+ 'height' => 180,
+ 'bits' => 0,
+ 'media_type' => MEDIATYPE_VIDEO,
+ 'mime' => 'application/ogg',
+ 'metadata' => serialize( array() ),
+ 'sha1' => Wikimedia\base_convert( '', 16, 36, 31 ),
+ 'fileExists' => true
+ ), $this->db->timestamp( '20010115123500' ), $user );
+ }
+
+ # A DjVu file
# A DjVu file
$image = wfLocalFile( Title::makeTitle( NS_FILE, 'LoremIpsum.djvu' ) );
if ( !$this->db->selectField( 'image', '1', array( 'img_name' => $image->getName() ) ) ) {
</OBJECT>
</BODY>
</DjVuXML>',
- 'sha1' => wfBaseConvert( '', 16, 36, 31 ),
+ 'sha1' => Wikimedia\base_convert( '', 16, 36, 31 ),
'fileExists' => true
), $this->db->timestamp( '20140115123600' ), $user );
}
}
- //ParserTest setup/teardown functions
+ // ParserTest setup/teardown functions
/**
* Set up the global variables for a consistent environment for each test.
foreach ( $configLines as $line ) {
list( $var, $value ) = explode( '=', $line, 2 );
- $settings[$var] = eval( "return $value;" ); //???
+ $settings[$var] = eval( "return $value;" ); // ???
}
}
$backend->delete( array( 'src' => $file ), array( 'force' => 1 ) );
}
foreach ( $files as $file ) {
- $tmp = $file;
- while ( $tmp = FileBackend::parentStoragePath( $tmp ) ) {
+ $tmp = FileBackend::parentStoragePath( $file );
+ while ( $tmp ) {
if ( !$backend->clean( array( 'dir' => $tmp ) )->isOK() ) {
break;
}
+ $tmp = FileBackend::parentStoragePath( $tmp );
}
}
}
/**
* @group medium
+ * @group ParserTests
* @dataProvider parserTestProvider
* @param string $desc
* @param string $input
public function testParserTest( $desc, $input, $result, $opts, $config ) {
if ( $this->regex != '' && !preg_match( '/' . $this->regex . '/', $desc ) ) {
$this->assertTrue( true ); // XXX: don't flood output with "test made no assertions"
- //$this->markTestSkipped( 'Filtered out by the user' );
+ // $this->markTestSkipped( 'Filtered out by the user' );
return;
}
if ( $id % 100 == 0 ) {
$usage = intval( memory_get_usage( true ) / $this->memoryLimit / 1048576 * 100 );
- //echo "{$this->fuzzSeed}: $numSuccess/$numTotal (mem: $usage%)\n";
+ // echo "{$this->fuzzSeed}: $numSuccess/$numTotal (mem: $usage%)\n";
if ( $usage > 90 ) {
$ret = "Out of memory:\n";
$memStats = $this->getMemoryBreakdown();
}
}
- //Various getter functions
+ // Various getter functions
/**
* Get an input dictionary from a set of parser test files
return $parser;
}
- //Various action functions
+ // Various action functions
public function addArticle( $name, $text, $line ) {
self::$articles[$name] = array( $text, $line );
return isset( $wgParser->mTransparentTagHooks[$name] );
}
- //Various "cleanup" functions
+ // Various "cleanup" functions
/**
* Remove last character if it is a newline
}
}
- //Test options parser functions
+ // Test options parser functions
protected function parseOptions( $instring ) {
$opts = array();