Merge "Fix 'Tags' padding to keep it farther from the edge and document the source...
[lhc/web/wiklou.git] / tests / phpunit / includes / registration / ExtensionRegistryTest.php
index 67bc088..7120a91 100644 (file)
@@ -51,6 +51,37 @@ class ExtensionRegistryTest extends MediaWikiTestCase {
                $registry->loadFromQueue();
        }
 
+       public function testLoadFromQueue() {
+               $registry = new ExtensionRegistry();
+               $registry->queue( "{$this->dataDir}/good.json" );
+               $registry->loadFromQueue();
+               $this->assertArrayHasKey( 'FooBar', $registry->getAllThings() );
+               $this->assertTrue( $registry->isLoaded( 'FooBar' ) );
+               $this->assertSame( [ 'test' ], $registry->getAttribute( 'FooBarAttr' ) );
+               $this->assertSame( [], $registry->getAttribute( 'NotLoadedAttr' ) );
+       }
+
+       /**
+        * @expectedException PHPUnit_Framework_Error
+        */
+       public function testReadFromQueue_nonexistent() {
+               $registry = new ExtensionRegistry();
+               $registry->readFromQueue( [
+                       __DIR__ . '/doesnotexist.json' => 1
+               ] );
+       }
+
+       public function testReadFromQueueInitializeAutoloaderWithPsr4Namespaces() {
+               $registry = new ExtensionRegistry();
+               $registry->readFromQueue( [
+                       "{$this->dataDir}/autoload_namespaces.json" => 1
+               ] );
+               $this->assertTrue(
+                       class_exists( 'Test\\MediaWiki\\AutoLoader\\TestFooBar' ),
+                       "Registry initializes Autoloader from AutoloadNamespaces"
+               );
+       }
+
        /**
         * @dataProvider provideExportExtractedDataGlobals
         */