From: Chad Horohoe Date: Fri, 12 Mar 2010 22:52:11 +0000 (+0000) Subject: Force loading of Sanitizer in setUp() so defines() are always present before tests. X-Git-Tag: 1.31.0-rc.0~37476 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=a9bc586e620d4e46f21780dff5c8ebab8c6856fa;p=lhc%2Fweb%2Fwiklou.git Force loading of Sanitizer in setUp() so defines() are always present before tests. --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index be1374670b..4f5a9c1852 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -664,6 +664,17 @@ class AutoLoader { } } } + + /** + * Force a class to be run through the autoloader, helpful for things like + * Sanitizer that have define()s outside of their class definition. Of course + * this wouldn't be necessary if everything in MediaWiki was class-based. Sigh. + * + * @return Boolean Return the results of class_exists() so we know if we were successful + */ + static function loadClass( $class ) { + return class_exists( $class ); + } } function wfLoadAllExtensions() { diff --git a/maintenance/tests/SanitizerTest.php b/maintenance/tests/SanitizerTest.php index 886fac30a8..a12f9013f0 100644 --- a/maintenance/tests/SanitizerTest.php +++ b/maintenance/tests/SanitizerTest.php @@ -2,6 +2,10 @@ class SanitizerTest extends PHPUnit_Framework_TestCase { + function setUp() { + AutoLoader::loadClass( 'Sanitizer' ); + } + function testDecodeNamedEntities() { $this->assertEquals( "\xc3\xa9cole",