* and all that fun stuff
*/
function start() {
- global $wgDBtype;
$this->db->begin();
if ( ! $this->db->tableExists( 'testrun' )
'tr_uname' => php_uname()
),
__METHOD__ );
- if ( $wgDBtype === 'postgres' ) {
+ if ( $this->db->getType() === 'postgres' ) {
$this->curRun = $this->db->currentSequenceValue( 'testrun_id_seq' );
} else {
$this->curRun = $this->db->insertId();
private $lineNum;
private $eof;
- function __construct( $file, $parserTest = null ) {
+ function __construct( $file, $parserTest ) {
global $IP;
$this->file = $file;
}
$this->parserTest = $parserTest;
-
- if ( $this->parserTest ) {
- $this->parserTest->showRunFile( wfRelativePath( $this->file, $IP ) );
- }
+ $this->parserTest->showRunFile( wfRelativePath( $this->file, $IP ) );
$this->lineNum = $this->index = 0;
}
wfDie( "'endarticle' without 'article' at line {$this->lineNum} of $this->file\n" );
}
- if ( $this->parserTest ) {
- $this->parserTest->addArticle( ParserTest::chomp( $data['article'] ), $data['text'], $this->lineNum );
- } else {
- wfDie("Cannot add an article without a parserTest instance");
- ParserTest::addArticle( $data['article'], $data['text'], $this->lineNum );
- }
+ $this->parserTest->addArticle( ParserTest::chomp( $data['article'] ), $data['text'], $this->lineNum );
+
$data = array();
$section = null;
$line = trim( $line );
if ( $line ) {
- if ( $this->parserTest && !$this->parserTest->requireHook( $line ) ) {
+ if ( !$this->parserTest->requireHook( $line ) ) {
return false;
}
}
$line = trim( $line );
if ( $line ) {
- if ( $this->parserTest && !$this->parserTest->requireFunctionHook( $line ) ) {
+ if ( !$this->parserTest->requireFunctionHook( $line ) ) {
return false;
}
}
if ( !isset( $data['config'] ) )
$data['config'] = '';
- if ( $this->parserTest
- && ( ( preg_match( '/\\bdisabled\\b/i', $data['options'] ) && !$this->parserTest->runDisabled )
+ if ( ( ( preg_match( '/\\bdisabled\\b/i', $data['options'] ) && !$this->parserTest->runDisabled )
|| !preg_match( "/" . $this->parserTest->regex . "/i", $data['test'] ) ) ) {
# disabled test
$data = array();
continue;
}
- global $wgUseTeX;
-
- if ( $this->parserTest &&
- preg_match( '/\\bmath\\b/i', $data['options'] ) && !$wgUseTeX ) {
- # don't run math tests if $wgUseTeX is set to false in LocalSettings
- $data = array();
- $section = null;
-
- continue;
- }
-
- if ( $this->parserTest ) {
- $this->test = array(
- 'test' => ParserTest::chomp( $data['test'] ),
- 'input' => ParserTest::chomp( $data['input'] ),
- 'result' => ParserTest::chomp( $data['result'] ),
- 'options' => ParserTest::chomp( $data['options'] ),
- 'config' => ParserTest::chomp( $data['config'] ) );
- } else {
- $this->test['test'] = $data['test'];
- }
+ $this->test = array(
+ 'test' => ParserTest::chomp( $data['test'] ),
+ 'input' => ParserTest::chomp( $data['input'] ),
+ 'result' => ParserTest::chomp( $data['result'] ),
+ 'options' => ParserTest::chomp( $data['options'] ),
+ 'config' => ParserTest::chomp( $data['config'] ) );
return true;
}