Merge "Drop zh-tw message "saveprefs""
[lhc/web/wiklou.git] / tests / phpunit / includes / registration / ExtensionProcessorTest.php
index 2df5568..1cb8a5d 100644 (file)
@@ -14,7 +14,7 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
         *
         * @var array
         */
-       static $default = array(
+       public static $default = array(
                'name' => 'FooBar',
        );
 
@@ -38,6 +38,7 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
        }
 
        public static function provideRegisterHooks() {
+               $merge = array( ExtensionRegistry::MERGE_STRATEGY => 'array_merge_recursive' );
                // Format:
                // Current $wgHooks
                // Content in extension.json
@@ -47,19 +48,19 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
                        array(
                                array(),
                                self::$default,
-                               array(),
+                               $merge,
                        ),
                        // No current hooks, adding one for "FooBaz"
                        array(
                                array(),
                                array( 'Hooks' => array( 'FooBaz' => 'FooBazCallback' ) ) + self::$default,
-                               array( 'FooBaz' => array( 'FooBazCallback' ) ),
+                               array( 'FooBaz' => array( 'FooBazCallback' ) ) + $merge,
                        ),
                        // Hook for "FooBaz", adding another one
                        array(
                                array( 'FooBaz' => array( 'PriorCallback' ) ),
                                array( 'Hooks' => array( 'FooBaz' => 'FooBazCallback' ) ) + self::$default,
-                               array( 'FooBaz' => array( 'PriorCallback', 'FooBazCallback' ) ),
+                               array( 'FooBaz' => array( 'PriorCallback', 'FooBazCallback' ) ) + $merge,
                        ),
                        // Hook for "BarBaz", adding one for "FooBaz"
                        array(
@@ -68,7 +69,7 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
                                array(
                                        'BarBaz' => array( 'BarBazCallback' ),
                                        'FooBaz' => array( 'FooBazCallback' ),
-                               ),
+                               ) + $merge,
                        ),
                        // Callbacks for FooBaz wrapped in an array
                        array(
@@ -76,7 +77,7 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
                                array( 'Hooks' => array( 'FooBaz' => array( 'Callback1' ) ) ) + self::$default,
                                array(
                                        'FooBaz' => array( 'Callback1' ),
-                               ),
+                               ) + $merge,
                        ),
                        // Multiple callbacks for FooBaz hook
                        array(
@@ -84,7 +85,7 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
                                array( 'Hooks' => array( 'FooBaz' => array( 'Callback1', 'Callback2' ) ) ) + self::$default,
                                array(
                                        'FooBaz' => array( 'Callback1', 'Callback2' ),
-                               ),
+                               ) + $merge,
                        ),
                );
        }
@@ -112,11 +113,20 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
                                '@IGNORED' => 'yes',
                        ),
                ) + self::$default;
+               $info2 = array(
+                       'config' => array(
+                               '_prefix' => 'eg',
+                               'Bar' => 'somevalue'
+                       ),
+               ) + self::$default;
                $processor->extractInfo( $this->dir, $info, 1 );
+               $processor->extractInfo( $this->dir, $info2, 1 );
                $extracted = $processor->getExtractedInfo();
                $this->assertEquals( 'somevalue', $extracted['globals']['wgBar'] );
                $this->assertEquals( 10, $extracted['globals']['wgFoo'] );
                $this->assertArrayNotHasKey( 'wg@IGNORED', $extracted['globals'] );
+               // Custom prefix:
+               $this->assertEquals( 'somevalue', $extracted['globals']['egBar'] );
        }
 
        public static function provideExtracttExtensionMessagesFiles() {