Merge "DifferenceEngine: Remove broken comment"
[lhc/web/wiklou.git] / tests / phpunit / includes / parser / NewParserTest.php
index 6975939..9551b2f 100644 (file)
@@ -31,6 +31,11 @@ class NewParserTest extends MediaWikiTestCase {
 
        protected $file = false;
 
+       public static function setUpBeforeClass() {
+               // Inject ParserTest well-known interwikis
+               ParserTest::setupInterwikis();
+       }
+
        protected function setUp() {
                global $wgNamespaceAliases;
                global $wgHooks, $IP;
@@ -155,50 +160,9 @@ class NewParserTest extends MediaWikiTestCase {
 
        function addDBData() {
                $this->tablesUsed[] = 'site_stats';
-               $this->tablesUsed[] = 'interwiki';
                # disabled for performance
                #$this->tablesUsed[] = 'image';
 
-               # Hack: insert a few Wikipedia in-project interwiki prefixes,
-               # for testing inter-language links
-               $this->db->insert( 'interwiki', array(
-                               array( 'iw_prefix' => 'wikipedia',
-                                       'iw_url' => 'http://en.wikipedia.org/wiki/$1',
-                                       'iw_api' => '',
-                                       'iw_wikiid' => '',
-                                       'iw_local' => 0 ),
-                               array( 'iw_prefix' => 'meatball',
-                                       'iw_url' => 'http://www.usemod.com/cgi-bin/mb.pl?$1',
-                                       'iw_api' => '',
-                                       'iw_wikiid' => '',
-                                       'iw_local' => 0 ),
-                               array( 'iw_prefix' => 'zh',
-                                       'iw_url' => 'http://zh.wikipedia.org/wiki/$1',
-                                       'iw_api' => '',
-                                       'iw_wikiid' => '',
-                                       'iw_local' => 1 ),
-                               array( 'iw_prefix' => 'es',
-                                       'iw_url' => 'http://es.wikipedia.org/wiki/$1',
-                                       'iw_api' => '',
-                                       'iw_wikiid' => '',
-                                       'iw_local' => 1 ),
-                               array( 'iw_prefix' => 'fr',
-                                       'iw_url' => 'http://fr.wikipedia.org/wiki/$1',
-                                       'iw_api' => '',
-                                       'iw_wikiid' => '',
-                                       'iw_local' => 1 ),
-                               array( 'iw_prefix' => 'ru',
-                                       'iw_url' => 'http://ru.wikipedia.org/wiki/$1',
-                                       'iw_api' => '',
-                                       'iw_wikiid' => '',
-                                       'iw_local' => 1 ),
-                               /**
-                                * @todo Fixme! Why are we inserting duplicate data here? Shouldn't
-                                * need this IGNORE or shouldn't need the insert at all.
-                                */
-                       ), __METHOD__, array( 'IGNORE' )
-               );
-
                # Update certain things in site_stats
                $this->db->insert( 'site_stats',
                        array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ),
@@ -353,10 +317,11 @@ class NewParserTest extends MediaWikiTestCase {
                        'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ),
                        'wgLanguageCode' => $lang,
                        'wgDBprefix' => $this->db->getType() != 'oracle' ? 'unittest_' : 'ut_',
-                       'wgRawHtml' => isset( $opts['rawhtml'] ),
+                       'wgRawHtml' => self::getOptionValue( 'wgRawHtml', $opts, false ),
                        'wgNamespacesWithSubpages' => array( NS_MAIN => isset( $opts['subpage'] ) ),
+                       'wgAllowExternalImages' => self::getOptionValue( 'wgAllowExternalImages', $opts, true ),
                        'wgMaxTocLevel' => $maxtoclevel,
-                       'wgUseTeX' => isset( $opts['math'] ),
+                       'wgUseTeX' => isset( $opts['math'] ) || isset( $opts['texvc'] ),
                        'wgMathDirectory' => $uploadDir . '/math',
                        'wgDefaultLanguageVariant' => $variant,
                        'wgLinkHolderBatchSize' => $linkHolderBatchSize,
@@ -616,6 +581,20 @@ class NewParserTest extends MediaWikiTestCase {
 
                $title = Title::newFromText( $titleText );
 
+               # Parser test requiring math. Make sure texvc is executable
+               # or just skip such tests.
+               if ( isset( $opts['math'] ) || isset( $opts['texvc'] ) ) {
+                       global $wgTexvc;
+
+                       if ( !isset( $wgTexvc ) ) {
+                               $this->markTestSkipped( "SKIPPED: \$wgTexvc is not set" );
+                       } elseif ( !is_executable( $wgTexvc ) ) {
+                               $this->markTestSkipped( "SKIPPED: texvc binary does not exist"
+                                       . " or is not executable.\n"
+                                       . "Current configuration is:\n\$wgTexvc = '$wgTexvc'" );
+                       }
+               }
+
                if ( isset( $opts['pst'] ) ) {
                        $out = $parser->preSaveTransform( $input, $title, $user, $options );
                } elseif ( isset( $opts['msg'] ) ) {