From d71ce5ab3ae1fae925d42cac4896960538a3d14b Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Thu, 18 Dec 2014 14:56:58 -0800 Subject: [PATCH] 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 --- tests/phpunit/includes/HtmlFormatterTest.php | 14 ++++++++++++++ tests/testHelpers.inc | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) 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 ) ) -- 2.20.1