3 class ExtensionRegistryTest
extends MediaWikiTestCase
{
6 * @covers ExtensionRegistry::exportExtractedData
7 * @dataProvider provideExportExtractedDataGlobals
8 * @@backupGlobals enabled
10 public function testExportExtractedDataGlobals( $desc, $before, $globals, $expected ) {
12 foreach ( $before as $key => $value ) {
13 $GLOBALS[$key] = $value;
17 'globals' => $globals,
18 'callbacks' => array(),
21 'attributes' => array(),
23 $registry = new ExtensionRegistry();
24 $class = new ReflectionClass( 'ExtensionRegistry' );
25 $method = $class->getMethod( 'exportExtractedData' );
26 $method->setAccessible( true );
27 $method->invokeArgs( $registry, array( $info ) );
28 foreach ( $expected as $name => $value ) {
29 $this->assertArrayHasKey( $name, $GLOBALS, $desc );
30 $this->assertEquals( $value, $GLOBALS[$name], $desc );
34 public static function provideExportExtractedDataGlobals() {
35 // "mwtest" prefix used instead of "$wg" to avoid potential conflicts
38 'Simple non-array values',
40 'mwtestFooBarConfig' => true,
41 'mwtestFooBarConfig2' => 'string',
44 'mwtestFooBarDefault' => 1234,
45 'mwtestFooBarConfig' => false,
48 'mwtestFooBarConfig' => true,
49 'mwtestFooBarConfig2' => 'string',
50 'mwtestFooBarDefault' => 1234,
54 'No global already set, simple array',
57 'mwtestDefaultOptions' => array(
62 'mwtestDefaultOptions' => array(
68 'Global already set, simple array',
70 'mwtestDefaultOptions' => array(
76 'mwtestDefaultOptions' => array(
82 'mwtestDefaultOptions' => array(
90 'No global already set, $wgHooks',
96 'FooBarEvent' => array(
97 'FooBarClass::onFooBarEvent'
103 'FooBarEvent' => array(
104 'FooBarClass::onFooBarEvent'
110 'Global already set, $wgHooks',
113 'FooBarEvent' => array(
114 'FooBarClass::onFooBarEvent'
116 'BazBarEvent' => array(
117 'FooBarClass::onBazBarEvent',
123 'FooBarEvent' => array(
124 'BazBarClass::onFooBarEvent',
130 'FooBarEvent' => array(
131 'FooBarClass::onFooBarEvent',
132 'BazBarClass::onFooBarEvent',
134 'BazBarEvent' => array(
135 'FooBarClass::onBazBarEvent',
141 'Global already set, $wgGroupPermissions',
143 'wgGroupPermissions' => array(
148 'somethingtwo' => true,
153 'wgGroupPermissions' => array(
154 'customgroup' => array(
159 'somethingtwo' => false,
164 'wgGroupPermissions' => array(
165 'customgroup' => array(
172 'somethingtwo' => true,