Merge "registration: Ignore attributes that start with @"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 23 Jan 2015 18:35:09 +0000 (18:35 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 23 Jan 2015 18:35:09 +0000 (18:35 +0000)
includes/registration/ExtensionProcessor.php
tests/phpunit/includes/registration/ExtensionProcessorTest.php

index 45bea64..14fc532 100644 (file)
@@ -129,7 +129,8 @@ class ExtensionProcessor implements Processor {
                foreach ( $info as $key => $val ) {
                        if ( in_array( $key, self::$globalSettings ) ) {
                                $this->storeToArray( "wg$key", $val, $this->globals );
-                       } elseif ( !in_array( $key, $this->processed ) ) {
+                       // Ignore anything that starts with a @
+                       } elseif ( $key[0] !== '@' && !in_array( $key, $this->processed ) ) {
                                $this->storeToArray( $key, $val, $this->attributes );
                        }
                }
index 221c258..e57c2b3 100644 (file)
@@ -18,6 +18,23 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
                'name' => 'FooBar',
        );
 
+       /**
+        * @covers ExtensionProcessor::extractInfo
+        */
+       public function testExtractInfo() {
+               // Test that attributes that begin with @ are ignored
+               $processor = new ExtensionProcessor();
+               $processor->extractInfo( $this->dir, self::$default + array(
+                       '@metadata' => array( 'foobarbaz' ),
+                       'AnAttribute' => array( 'omg' ),
+               ) );
+
+               $extracted = $processor->getExtractedInfo();
+               $attributes = $extracted['attributes'];
+               $this->assertArrayHasKey( 'AnAttribute', $attributes );
+               $this->assertArrayNotHasKey( '@metadata', $attributes );
+       }
+
        public static function provideRegisterHooks() {
                return array(
                        // No hooks