diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-17 09:15:42 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-17 09:44:51 +0100 |
commit | a1789ddde42033f1b05cc4929491214ee6e79383 (patch) | |
tree | 63615735c4ddffaaabf2428946bb26f90899f7bf /tests/phpunit/ResourceLoaderTestCase.php | |
parent | 9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff) |
Update to MediaWiki 1.26.0
Diffstat (limited to 'tests/phpunit/ResourceLoaderTestCase.php')
-rw-r--r-- | tests/phpunit/ResourceLoaderTestCase.php | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/tests/phpunit/ResourceLoaderTestCase.php b/tests/phpunit/ResourceLoaderTestCase.php index deecb31e..325b20ee 100644 --- a/tests/phpunit/ResourceLoaderTestCase.php +++ b/tests/phpunit/ResourceLoaderTestCase.php @@ -25,27 +25,35 @@ abstract class ResourceLoaderTestCase extends MediaWikiTestCase { return $ctx; } - protected function setUp() { - parent::setUp(); - - ResourceLoader::clearCache(); - - $this->setMwGlobals( array( + public static function getSettings() { + return array( // For ResourceLoader::inDebugMode since it doesn't have context - 'wgResourceLoaderDebug' => true, + 'ResourceLoaderDebug' => true, // Avoid influence from wgInvalidateCacheOnLocalSettingsChange - 'wgCacheEpoch' => '20140101000000', + 'CacheEpoch' => '20140101000000', // For ResourceLoader::__construct() - 'wgResourceLoaderSources' => array(), + 'ResourceLoaderSources' => array(), // For wfScript() - 'wgScriptPath' => '/w', - 'wgScriptExtension' => '.php', - 'wgScript' => '/w/index.php', - 'wgLoadScript' => '/w/load.php', - ) ); + 'ScriptPath' => '/w', + 'ScriptExtension' => '.php', + 'Script' => '/w/index.php', + 'LoadScript' => '/w/load.php', + ); + } + + protected function setUp() { + parent::setUp(); + + ResourceLoader::clearCache(); + + $globals = array(); + foreach ( self::getSettings() as $key => $value ) { + $globals['wg' . $key] = $value; + } + $this->setMwGlobals( $globals ); } } @@ -68,14 +76,14 @@ class ResourceLoaderTestModule extends ResourceLoaderModule { } public function getScript( ResourceLoaderContext $context ) { - return $this->script; + return $this->validateScriptFile( 'input', $this->script ); } public function getStyles( ResourceLoaderContext $context ) { return array( '' => $this->styles ); } - public function getDependencies() { + public function getDependencies( ResourceLoaderContext $context = null ) { return $this->dependencies; } @@ -94,6 +102,10 @@ class ResourceLoaderTestModule extends ResourceLoaderModule { public function isRaw() { return $this->isRaw; } + + public function enableModuleContentVersion() { + return true; + } } class ResourceLoaderFileModuleTestModule extends ResourceLoaderFileModule { |