*/
public function __construct( $options = array() ) {
# Only colorize output if stdout is a terminal.
- $this->color = !wfIsWindows() && posix_isatty( 1 );
+ $this->color = !wfIsWindows() && Maintenance::posix_isatty( 1 );
if ( isset( $options['color'] ) ) {
switch( $options['color'] ) {
$wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
$wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo,
$parserMemc, $wgThumbnailScriptPath, $wgScriptPath,
- $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath;
+ $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath, $wgExtensionAssetsPath;
$wgScript = '/index.php';
$wgScriptPath = '/';
$wgArticlePath = '/wiki/$1';
$wgStyleSheetPath = '/skins';
$wgStylePath = '/skins';
+ $wgExtensionAssetsPath = '/extensions';
$wgThumbnailScriptPath = false;
$wgLocalFileRepo = array(
'class' => 'LocalRepo',
$wgLang = $context->getLang();
$wgOut = $context->getOutput();
$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
- $wgRequest = new WebRequest;
+ $wgRequest = $context->getRequest();
if ( $wgStyleDirectory === false ) {
$wgStyleDirectory = "$IP/skins";
$options['setversion'] : SpecialVersion::getVersion();
} elseif ( isset( $options['compare'] ) ) {
$this->recorder = new DbTestPreviewer( $this );
- } elseif ( isset( $options['upload'] ) ) {
- $this->recorder = new RemoteTestRecorder( $this );
} else {
$this->recorder = new TestRecorder( $this );
}
if ( isset( $opts['pst'] ) ) {
$out = $parser->preSaveTransform( $input, $title, $user, $options );
} elseif ( isset( $opts['msg'] ) ) {
- $out = $parser->transformMsg( $input, $options );
+ $out = $parser->transformMsg( $input, $options, $title );
} elseif ( isset( $opts['section'] ) ) {
$section = $opts['section'];
$out = $parser->getSection( $input, $section );
$replace = $opts['replace'][1];
$out = $parser->replaceSection( $input, $section, $replace );
} elseif ( isset( $opts['comment'] ) ) {
- $linker = $user->getSkin();
- $out = $linker->formatComment( $input, $title, $local );
+ $out = Linker::formatComment( $input, $title, $local );
} elseif ( isset( $opts['preload'] ) ) {
$out = $parser->getpreloadText( $input, $title, $options );
} else {
global $wgHooks;
$wgHooks['ParserTestParser'][] = 'ParserTestParserHook::setup';
- $wgHooks['ParserTestParser'][] = 'ParserTestStaticParserHook::setup';
$wgHooks['ParserGetVariableValueTs'][] = 'ParserTest::getFakeTimestamp';
MagicWord::clearCache();
return $dir;
}
- wfMkdirParents( $dir . '/3/3a' );
+ wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
- wfMkdirParents( $dir . '/0/09' );
+ wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
return $dir;
$shellInfile = wfEscapeShellArg($infile);
$shellOutfile = wfEscapeShellArg($outfile);
- $diff = wfIsWindows()
+ global $wgDiff3;
+ // we assume that people with diff3 also have usual diff
+ $diff = ( wfIsWindows() && !$wgDiff3 )
? `fc $shellInfile $shellOutfile`
: `diff -au $shellInfile $shellOutfile`;
unlink( $infile );
$title = Title::newFromText( $name );
if ( is_null( $title ) ) {
- wfDie( "invalid title ('$name' => '$title') at line $line\n" );
+ throw new MWException( "invalid title ('$name' => '$title') at line $line\n" );
}
$aid = $title->getArticleID( Title::GAID_FOR_UPDATE );
if ( $aid != 0 ) {
- debug_print_backtrace();
- wfDie( "duplicate article '$name' at line $line\n" );
+ throw new MWException( "duplicate article '$name' at line $line\n" );
}
$art = new Article( $title );
*
* @param $text String: the text to tidy
* @return String
- * @static
*/
private function tidy( $text ) {
global $wgUseTidy;