Fix issues identified by SpaceBeforeSingleLineComment sniff
[lhc/web/wiklou.git] / tests / phpunit / includes / parser / NewParserTest.php
index 91aad10..ff4a527 100644 (file)
@@ -27,7 +27,7 @@ class NewParserTest extends MediaWikiTestCase {
        public $functionHooks = array();
        public $transparentHooks = array();
 
-       //Fuzz test
+       // Fuzz test
        public $maxFuzzTestLength = 300;
        public $fuzzSeed = 0;
        public $memoryLimit = 50;
@@ -54,7 +54,7 @@ class NewParserTest extends MediaWikiTestCase {
 
                parent::setUp();
 
-               //Setup CLI arguments
+               // Setup CLI arguments
                if ( $this->getCliArg( 'regex' ) ) {
                        $this->regex = $this->getCliArg( 'regex' );
                } else {
@@ -91,7 +91,7 @@ class NewParserTest extends MediaWikiTestCase {
                );
                $tmpGlobals['wgForeignFileRepos'] = array();
                $tmpGlobals['wgDefaultExternalStore'] = array();
-               $tmpGlobals['wgEnableParserCache'] = false;
+               $tmpGlobals['wgParserCacheType'] = CACHE_NONE;
                $tmpGlobals['wgCapitalLinks'] = true;
                $tmpGlobals['wgNoFollowLinks'] = true;
                $tmpGlobals['wgNoFollowDomainExceptions'] = array();
@@ -106,7 +106,6 @@ class NewParserTest extends MediaWikiTestCase {
                $tmpGlobals['wgAdaptiveMessageCache'] = true;
                $tmpGlobals['wgUseDatabaseMessages'] = true;
                $tmpGlobals['wgLocaltimezone'] = 'UTC';
-               $tmpGlobals['wgDeferredUpdateList'] = array();
                $tmpGlobals['wgGroupPermissions'] = array(
                        '*' => array(
                                'createaccount' => true,
@@ -160,10 +159,10 @@ class NewParserTest extends MediaWikiTestCase {
                $this->djVuSupport = new DjVuSupport();
                // Tidy support
                $this->tidySupport = new TidySupport();
+               $tmpGlobals['wgTidyConfig'] = null;
                $tmpGlobals['wgUseTidy'] = false;
-               $tmpGlobals['wgAlwaysUseTidy'] = false;
                $tmpGlobals['wgDebugTidy'] = false;
-               $tmpGlobals['wgTidyConf'] = $IP . '/includes/tidy.conf';
+               $tmpGlobals['wgTidyConf'] = $IP . '/includes/tidy/tidy.conf';
                $tmpGlobals['wgTidyOpts'] = '';
                $tmpGlobals['wgTidyInternal'] = $this->tidySupport->isInternal();
 
@@ -185,6 +184,8 @@ class NewParserTest extends MediaWikiTestCase {
                $wgNamespaceAliases['Image'] = $this->savedWeirdGlobals['image_alias'];
                $wgNamespaceAliases['Image_talk'] = $this->savedWeirdGlobals['image_talk_alias'];
 
+               MWTidy::destroySingleton();
+
                // Restore backends
                RepoGroup::destroySingleton();
                FileBackendGroup::destroySingleton();
@@ -209,7 +210,7 @@ class NewParserTest extends MediaWikiTestCase {
        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',
@@ -345,7 +346,7 @@ class NewParserTest extends MediaWikiTestCase {
                }
        }
 
-       //ParserTest setup/teardown functions
+       // ParserTest setup/teardown functions
 
        /**
         * Set up the global variables for a consistent environment for each test.
@@ -425,7 +426,7 @@ class NewParserTest extends MediaWikiTestCase {
                        foreach ( $configLines as $line ) {
                                list( $var, $value ) = explode( '=', $line, 2 );
 
-                               $settings[$var] = eval( "return $value;" ); //???
+                               $settings[$var] = eval( "return $value;" ); // ???
                        }
                }
 
@@ -454,6 +455,7 @@ class NewParserTest extends MediaWikiTestCase {
                        $GLOBALS[$var] = $val;
                }
 
+               MWTidy::destroySingleton();
                MagicWord::clearCache();
 
                # The entries saved into RepoGroup cache with previous globals will be wrong.
@@ -680,7 +682,7 @@ class NewParserTest extends MediaWikiTestCase {
        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;
                }
 
@@ -863,7 +865,7 @@ class NewParserTest extends MediaWikiTestCase {
 
                        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();
@@ -880,7 +882,7 @@ class NewParserTest extends MediaWikiTestCase {
                }
        }
 
-       //Various getter functions
+       // Various getter functions
 
        /**
         * Get an input dictionary from a set of parser test files
@@ -954,7 +956,7 @@ class NewParserTest extends MediaWikiTestCase {
                return $parser;
        }
 
-       //Various action functions
+       // Various action functions
 
        public function addArticle( $name, $text, $line ) {
                self::$articles[$name] = array( $text, $line );
@@ -997,7 +999,7 @@ class NewParserTest extends MediaWikiTestCase {
                return isset( $wgParser->mTransparentTagHooks[$name] );
        }
 
-       //Various "cleanup" functions
+       // Various "cleanup" functions
 
        /**
         * Remove last character if it is a newline
@@ -1012,7 +1014,7 @@ class NewParserTest extends MediaWikiTestCase {
                }
        }
 
-       //Test options parser functions
+       // Test options parser functions
 
        protected function parseOptions( $instring ) {
                $opts = array();