From: Ori Livneh Date: Thu, 18 Dec 2014 22:56:58 +0000 (-0800) Subject: Set $wgInternalTidy to false in unit tests when running under HHVM X-Git-Tag: 1.31.0-rc.0~12916 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=d71ce5ab3ae1fae925d42cac4896960538a3d14b;p=lhc%2Fweb%2Fwiklou.git Set $wgInternalTidy to false in unit tests when running under HHVM 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 --- diff --git a/tests/phpunit/includes/HtmlFormatterTest.php b/tests/phpunit/includes/HtmlFormatterTest.php index 9dbfa452c8..1c3e8539c7 100644 --- a/tests/phpunit/includes/HtmlFormatterTest.php +++ b/tests/phpunit/includes/HtmlFormatterTest.php @@ -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 * diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index b5fc800326..bc02d0f1d8 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -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 ) )