Merge "Validate that $wgVariantArticlePath is absolute, too"
[lhc/web/wiklou.git] / tests / testHelpers.inc
index b5fc800..d73496f 100644 (file)
@@ -458,8 +458,11 @@ class TestFileIterator implements Iterator {
                        $this->sectionData['config'] = '';
                }
 
-               $isDisabled = preg_match( '/\\bdisabled\\b/i', $this->sectionData['options'] ) && !$this->parserTest->runDisabled;
-               $isParsoidOnly = preg_match( '/\\bparsoid\\b/i', $this->sectionData['options'] ) && $result == 'html' && !$this->parserTest->runParsoid;
+               $isDisabled = preg_match( '/\\bdisabled\\b/i', $this->sectionData['options'] ) &&
+                       !$this->parserTest->runDisabled;
+               $isParsoidOnly = preg_match( '/\\bparsoid\\b/i', $this->sectionData['options'] ) &&
+                       $result == 'html' &&
+                       !$this->parserTest->runParsoid;
                $isFiltered = !preg_match( "/" . $this->parserTest->regex . "/i", $this->sectionData['test'] );
                if ( $input == false || $result == false || $isDisabled || $isParsoidOnly || $isFiltered ) {
                        # disabled test
@@ -471,7 +474,7 @@ class TestFileIterator implements Iterator {
                $hooksResult = $this->delayedParserTest->unleash( $this->parserTest );
                if ( !$hooksResult ) {
                        # Some hook reported an issue. Abort.
-                       throw new MWException( "Problem running hook" );
+                       throw new MWException( "Problem running requested parser hook from the test file" );
                }
 
                $this->test = array(
@@ -618,6 +621,7 @@ class TestFileIterator implements Iterator {
         * @param bool $fatal True iff an exception should be thrown if
         * the section is not found.
         * @return bool|string
+        * @throws MWException
         */
        private function checkSection( $tokens, $fatal = true ) {
                if ( is_null( $this->section ) ) {
@@ -691,9 +695,10 @@ class DelayedParserTest {
         * Should be the case if we found the parserTest is not disabled
         * @param ParserTest|NewParserTest $parserTest
         * @return bool
+        * @throws MWException
         */
        public function unleash( &$parserTest ) {
-               if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest )     ) {
+               if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest ) ) {
                        throw new MWException( __METHOD__ . " must be passed an instance of ParserTest or "
                                . "NewParserTest classes\n" );
                }
@@ -805,7 +810,7 @@ class TidySupport {
                global $wgTidyBin;
 
                $this->internalTidy = extension_loaded( 'tidy' ) &&
-                       class_exists( 'tidy' );
+                       class_exists( 'tidy' ) && !wfIsHHVM();
 
                $this->externalTidy = is_executable( $wgTidyBin ) ||
                        Installer::locateExecutableInDefaultPaths( array( $wgTidyBin ) )