From: Antoine Musso Date: Fri, 21 Jun 2013 15:39:29 +0000 (+0200) Subject: test: skip math parser tests when missing $wgTexvc X-Git-Tag: 1.31.0-rc.0~19302^2 X-Git-Url: https://git.cyclocoop.org/?a=commitdiff_plain;h=2fe1b773d3da27e379485e049c239d9ac6cd6365;p=lhc%2Fweb%2Fwiklou.git test: skip math parser tests when missing $wgTexvc The Math extension has at least one test marked with the parsertest option 'texvc'. We now use it to detects whether $wgTexvc points to an executable binary and would skip such parser tests if not. 'math' option is kept for backward compatibility, just in case. Math extension has been updated to use this as of https://gerrit.wikimedia.org/r/#/c/69873/ bug: 49884 Change-Id: I992b5a5b7aac067f1e368cb3eeba224c056b76f9 --- diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php index 93923fdd97..54c7fb57ac 100644 --- a/tests/phpunit/includes/parser/NewParserTest.php +++ b/tests/phpunit/includes/parser/NewParserTest.php @@ -320,7 +320,7 @@ class NewParserTest extends MediaWikiTestCase { 'wgRawHtml' => isset( $opts['rawhtml'] ), 'wgNamespacesWithSubpages' => array( NS_MAIN => isset( $opts['subpage'] ) ), 'wgMaxTocLevel' => $maxtoclevel, - 'wgUseTeX' => isset( $opts['math'] ), + 'wgUseTeX' => isset( $opts['math'] ) || isset( $opts['texvc'] ), 'wgMathDirectory' => $uploadDir . '/math', 'wgDefaultLanguageVariant' => $variant, 'wgLinkHolderBatchSize' => $linkHolderBatchSize, @@ -580,6 +580,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'] ) ) {