summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Horohoe <demon@users.mediawiki.org>2010-03-12 22:59:19 +0000
committerChad Horohoe <demon@users.mediawiki.org>2010-03-12 22:59:19 +0000
commit608692addd30f04044c2d0abc159955eb3694e5f (patch)
treebd428309f1a57001ce16ec1633028c28da419681
parent815ebdcfb06c672e0b5d1ec81c1a8d54b2ebbc37 (diff)
Backport r63656, r63658 to REL1_161.16.0beta1
Notes
http://mediawiki.org/wiki/Special:Code/MediaWiki/63659
-rw-r--r--includes/AutoLoader.php11
-rw-r--r--maintenance/tests/SanitizerTest.php6
2 files changed, 15 insertions, 2 deletions
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index 4de8cda7d554..cecb53f912a7 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 6fb9d5a59b43..8a2287d55891 100644
--- a/maintenance/tests/SanitizerTest.php
+++ b/maintenance/tests/SanitizerTest.php
@@ -1,10 +1,12 @@
<?php
-global $IP;
-require_once( "$IP/includes/Sanitizer.php" );
class SanitizerTest extends PHPUnit_Framework_TestCase {
+ function setUp() {
+ AutoLoader::loadClass( 'Sanitizer' );
+ }
+
function testDecodeNamedEntities() {
$this->assertEquals(
"\xc3\xa9cole",