* @covers AutoLoader
*/
class AutoLoaderTest extends MediaWikiTestCase {
+
+ private $oldPsr4;
+
protected function setUp() {
parent::setUp();
$this->mergeMwGlobalArrayValue( 'wgAutoloadClasses', [
'TestAutoloadedClass' => __DIR__ . '/../data/autoloader/TestAutoloadedClass.php',
] );
+
+ $this->oldPsr4 = AutoLoader::$psr4Namespaces;
+ AutoLoader::$psr4Namespaces['Test\\MediaWiki\\AutoLoader\\'] =
+ __DIR__ . '/../data/autoloader/psr4';
+ }
+
+ protected function tearDown() {
+ AutoLoader::$psr4Namespaces = $this->oldPsr4;
+ parent::tearDown();
}
public function testCoreClass() {
$this->assertFalse( $uncerealized instanceof __PHP_Incomplete_Class,
"unserialize() can load classes case-insensitively." );
}
+
+ public function testPsr4() {
+ $this->assertTrue( class_exists( 'Test\\MediaWiki\\AutoLoader\\TestFooBar' ) );
+ }
}