Use ExtensionRegistry::setAttributeForTest() instead of Reflection
authorKunal Mehta <legoktm@member.fsf.org>
Mon, 3 Jun 2019 00:58:58 +0000 (20:58 -0400)
committerKunal Mehta <legoktm@member.fsf.org>
Mon, 3 Jun 2019 01:08:07 +0000 (21:08 -0400)
Change-Id: If29e8825f1734f8c0efa21aa77f6354fa3468248

tests/phpunit/includes/resourceloader/ResourceLoaderOOUIImageModuleTest.php

index ff09660..5df52bc 100644 (file)
@@ -25,20 +25,9 @@ class ResourceLoaderOOUIImageModuleTest extends ResourceLoaderTestCase {
                );
                $this->setService( 'SkinFactory', $skinFactory );
 
-               $r = new ReflectionMethod( ExtensionRegistry::class, 'exportExtractedData' );
-               $r->setAccessible( true );
-               $r->invoke( ExtensionRegistry::getInstance(), [
-                       'globals' => [],
-                       'defines' => [],
-                       'callbacks' => [],
-                       'credits' => [],
-                       'autoloaderPaths' => [],
-                       'attributes' => [
-                               'SkinOOUIThemes' => [
-                                       'fakemonobook' => 'Apex',
-                               ],
-                       ],
-               ] );
+               $reset = ExtensionRegistry::getInstance()->setAttributeForTest(
+                       'SkinOOUIThemes', [ 'fakemonobook' => 'Apex' ]
+               );
 
                $styles = $module->getStyles( $this->getResourceLoaderContext( [ 'skin' => 'fakemonobook' ] ) );
                $this->assertRegExp(