- $suite = new PHPUnit_Framework_TestSuite();
-
- global $wgHooks;
- $wgHooks['ParserTestTables'][] = "MediaWikiParserTestSuite::addTables";
-
- self::$iter = new TestFileIterator( PARSER_TESTS );
-
- foreach ( self::$iter as $i => $test ) {
- $suite->addTest( new ParserUnitTest( $i, $test['test'] ) );
- self::$count++;
- }
- unset( $tests );
-
- self::$parser = new PTShell;
- self::$iter->setParser( self::$parser );
- self::$parser->recorder->start();
- self::$parser->setupDatabase();
- self::$iter->rewind();
- /* } */
- /* function setUp() { */
- global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgDeferredUpdateList,
- $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
- $wgMessageCache, $wgUseDatabaseMessages, $wgMsgCacheExpiry, $parserMemc,
- $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo,
- $wgNamespacesWithSubpages, $wgThumbnailScriptPath, $wgScriptPath,
- $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath;
-
- $wgScript = '/index.php';
- $wgScriptPath = '/';
- $wgArticlePath = '/wiki/$1';
- $wgStyleSheetPath = '/skins';
- $wgStylePath = '/skins';
- $wgThumbnailScriptPath = false;
- $wgLocalFileRepo = array(
- 'class' => 'LocalRepo',
- 'name' => 'local',
- 'directory' => 'test-repo',
- 'url' => 'http://example.com/images',
- 'hashLevels' => 2,
- 'transformVia404' => false,
- );
- $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
- $wgNamespaceAliases['Image'] = NS_FILE;
- $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
-
-
- $wgEnableParserCache = false;
- $wgDeferredUpdateList = array();
- $wgMemc =& wfGetMainCache();
- $messageMemc =& wfGetMessageCacheStorage();
- $parserMemc =& wfGetParserCacheStorage();
-
- $wgContLang = new StubContLang;
- $wgUser = new StubUser;
- $wgLang = new StubUserLang;
- $wgOut = new StubObject( 'wgOut', 'OutputPage' );
- $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
- $wgRequest = new WebRequest;
-
- $wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache',
- array( $messageMemc, $wgUseDatabaseMessages,
- $wgMsgCacheExpiry, wfWikiID() ) );
- if ( $wgStyleDirectory === false ) $wgStyleDirectory = "$IP/skins";
-
- return $suite;