Merge "Clarify userrights-conflict"
[lhc/web/wiklou.git] / tests / parser / parserTest.inc
index 4efd708..e7c36db 100644 (file)
@@ -434,7 +434,12 @@ class ParserTest {
         */
        public function runTestsFromFiles( $filenames ) {
                $ok = false;
+
+               // be sure, ParserTest::addArticle has correct language set,
+               // so that system messages gets into the right language cache
+               $GLOBALS['wgLanguageCode'] = 'en';
                $GLOBALS['wgContLang'] = Language::factory( 'en' );
+
                $this->recorder->start();
                try {
                        $this->setupDatabase();
@@ -728,7 +733,7 @@ class ParserTest {
                        'wgSitename' => 'MediaWiki',
                        'wgLanguageCode' => $lang,
                        'wgDBprefix' => $this->db->getType() != 'oracle' ? 'parsertest_' : 'pt_',
-                       'wgRawHtml' => isset( $opts['rawhtml'] ),
+                       'wgRawHtml' => self::getOptionValue( 'wgRawHtml', $opts, false ),
                        'wgLang' => null,
                        'wgContLang' => null,
                        'wgNamespacesWithSubpages' => array( 0 => isset( $opts['subpage'] ) ),
@@ -741,7 +746,7 @@ class ParserTest {
                        'wgSVGConverter' => 'null',
                        'wgSVGConverters' => array( 'null' => 'echo "1">$output' ),
                        'wgLocaltimezone' => 'UTC',
-                       'wgAllowExternalImages' => true,
+                       'wgAllowExternalImages' => self::getOptionValue( 'wgAllowExternalImages', $opts, true ),
                        'wgUseTidy' => false,
                        'wgDefaultLanguageVariant' => $variant,
                        'wgVariantArticlePath' => false,
@@ -885,7 +890,8 @@ class ParserTest {
                }
 
                # Update certain things in site_stats
-               $this->db->insert( 'site_stats', array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ) );
+               $this->db->insert( 'site_stats',
+                       array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ) );
 
                # Reinitialise the LocalisationCache to match the database state
                Language::getLocalisationCache()->unloadAll();
@@ -982,8 +988,11 @@ class ParserTest {
                $tables = $this->listTables();
 
                foreach ( $tables as $table ) {
-                       $sql = $this->db->getType() == 'oracle' ? "DROP TABLE pt_$table DROP CONSTRAINTS" : "DROP TABLE `parsertest_$table`";
-                       $this->db->query( $sql );
+                       if ( $this->db->getType() == 'oracle' ) {
+                               $this->db->query( "DROP TABLE pt_$table DROP CONSTRAINTS" );
+                       } else {
+                               $this->db->query( "DROP TABLE `parsertest_$table`" );
+                       }
                }
 
                if ( $this->db->getType() == 'oracle' ) {
@@ -1210,7 +1219,9 @@ class ParserTest {
         * @param $outFileTail String: tailing for the output file name
         * @return String
         */
-       protected function quickDiff( $input, $output, $inFileTail = 'expected', $outFileTail = 'actual' ) {
+       protected function quickDiff( $input, $output,
+               $inFileTail = 'expected', $outFileTail = 'actual'
+       ) {
                # Windows, or at least the fc utility, is retarded
                $slash = wfIsWindows() ? '\\' : '/';
                $prefix = wfTempDir() . "{$slash}mwParser-" . mt_rand();
@@ -1429,7 +1440,7 @@ class ParserTest {
        }
 
        static function getFakeTimestamp( &$parser, &$ts ) {
-               $ts = 123;
+               $ts = 123; //parsed as '1970-01-01T00:02:03Z'
                return true;
        }
 }