diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /tests/phpunit/ResourceLoaderTestCase.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
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 { |