Set $wgInternalTidy to false in unit tests when running under HHVM
authorOri Livneh <ori@wikimedia.org>
Thu, 18 Dec 2014 22:56:58 +0000 (14:56 -0800)
committerOri Livneh <ori@wikimedia.org>
Thu, 18 Dec 2014 22:58:18 +0000 (14:58 -0800)
The Tidy extension for HHVM is nominally usable, but does not provide error
text returns. Tests should use TidySupport to determine whether they should use
the Tidy extension or not.

Change-Id: I0f842ddf8484206fc2a8b01289bc0a6750f34fed

tests/phpunit/includes/HtmlFormatterTest.php
tests/testHelpers.inc

index 9dbfa45..1c3e853 100644 (file)
@@ -4,6 +4,20 @@
  * @group HtmlFormatter
  */
 class HtmlFormatterTest extends MediaWikiTestCase {
+
+       /**
+        * Use TidySupport to check whether we should use $wgTidyInternal.
+        *
+        * The Tidy extension in HHVM does not support error text return, so it is
+        * nominally usable, but does not pass tests which require error text from
+        * Tidy.
+        */
+       protected function setUp() {
+               parent::setUp();
+               $tidySupport = new TidySupport();
+               $this->setMwGlobals( 'wgTidyInternal', $tidySupport->isInternal() );
+       }
+
        /**
         * @dataProvider getHtmlData
         *
index b5fc800..bc02d0f 100644 (file)
@@ -805,7 +805,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 ) )