summaryrefslogtreecommitdiff
path: root/tests/phpunit/ResourceLoaderTestCase.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/ResourceLoaderTestCase.php')
-rw-r--r--tests/phpunit/ResourceLoaderTestCase.php44
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 {