$processor->extractInfo( $this->dir, self::$default + array(
'@metadata' => array( 'foobarbaz' ),
'AnAttribute' => array( 'omg' ),
+ 'AutoloadClasses' => array( 'FooBar' => 'includes/FooBar.php' ),
) );
$extracted = $processor->getExtractedInfo();
$attributes = $extracted['attributes'];
$this->assertArrayHasKey( 'AnAttribute', $attributes );
$this->assertArrayNotHasKey( '@metadata', $attributes );
+ $this->assertArrayNotHasKey( 'AutoloadClasses', $attributes );
}
public static function provideRegisterHooks() {
+ // Format:
+ // Current $wgHooks
+ // Content in extension.json
+ // Expected value of $wgHooks
return array(
// No hooks
array(
'FooBaz' => array( 'FooBazCallback' ),
),
),
+ // Callbacks for FooBaz wrapped in an array
+ array(
+ array(),
+ array( 'Hooks' => array( 'FooBaz' => array( 'Callback1' ) ) ) + self::$default,
+ array(
+ 'FooBaz' => array( 'Callback1' ),
+ ),
+ ),
+ // Multiple callbacks for FooBaz hook
+ array(
+ array(),
+ array( 'Hooks' => array( 'FooBaz' => array( 'Callback1', 'Callback2' ) ) ) + self::$default,
+ array(
+ 'FooBaz' => array( 'Callback1', 'Callback2' ),
+ ),
+ ),
);
}
),
),
),
+ // ResourceModuleSkinStyles with file module paths
+ array(
+ // Input
+ array(
+ 'ResourceFileModulePaths' => array(
+ 'localBasePath' => '',
+ 'remoteSkinPath' => 'FooBar',
+ ),
+ 'ResourceModuleSkinStyles' => array(
+ 'foobar' => array(
+ 'test.foo' => 'foo.css',
+ )
+ ),
+ ),
+ // Expected
+ array(
+ 'wgResourceModuleSkinStyles' => array(
+ 'foobar' => array(
+ 'test.foo' => 'foo.css',
+ 'localBasePath' => $dir,
+ 'remoteSkinPath' => 'FooBar',
+ ),
+ ),
+ ),
+ ),
+ // ResourceModuleSkinStyles with file module paths and an override
+ array(
+ // Input
+ array(
+ 'ResourceFileModulePaths' => array(
+ 'localBasePath' => '',
+ 'remoteSkinPath' => 'FooBar',
+ ),
+ 'ResourceModuleSkinStyles' => array(
+ 'foobar' => array(
+ 'test.foo' => 'foo.css',
+ 'remoteSkinPath' => 'BarFoo'
+ ),
+ ),
+ ),
+ // Expected
+ array(
+ 'wgResourceModuleSkinStyles' => array(
+ 'foobar' => array(
+ 'test.foo' => 'foo.css',
+ 'localBasePath' => $dir,
+ 'remoteSkinPath' => 'BarFoo',
+ ),
+ ),
+ ),
+ ),
);
}