Force loading of Sanitizer in setUp() so defines() are always present before tests.
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 12 Mar 2010 22:52:11 +0000 (22:52 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 12 Mar 2010 22:52:11 +0000 (22:52 +0000)
includes/AutoLoader.php
maintenance/tests/SanitizerTest.php

index be13746..4f5a9c1 100644 (file)
@@ -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() {
index 886fac3..a12f901 100644 (file)
@@ -2,6 +2,10 @@
 
 class SanitizerTest extends PHPUnit_Framework_TestCase {
 
+       function setUp() {
+               AutoLoader::loadClass( 'Sanitizer' );
+       }
+
        function testDecodeNamedEntities() {
                $this->assertEquals(
                        "\xc3\xa9cole",