wiki.techinc.nl/tests/phpunit/ResourceLoaderTestCase.php
Timo Tijhof 99a4c31425 resourceloader: Consistently pass inDebugMode to encodeJsCall() in load.php
Still quite a few were being minified unconditinally. This is in
preparation for adding unit tests for the startup module where
it'll make reading the unit tests (and looking at the diff in case
of a failure) a lot easier if the strings aren't minified.

Change-Id: Ia06787e0ce608fcafac4596c980606d06107f517
2014-03-07 19:11:19 +00:00

44 lines
1.1 KiB
PHP

<?php
abstract class ResourceLoaderTestCase extends MediaWikiTestCase {
protected static function getResourceLoaderContext() {
$resourceLoader = new ResourceLoader();
$request = new FauxRequest( array(
'debug' => 'true',
'lang' => 'en',
'modules' => 'startup',
'only' => 'scripts',
'skin' => 'vector',
'target' => 'test',
) );
return new ResourceLoaderContext( $resourceLoader, $request );
}
protected function setUp() {
parent::setUp();
$this->setMwGlobals( array(
// For ResourceLoader::inDebugMode since it doesn't have context
'wgResourceLoaderDebug' => true,
// Avoid influence from wgInvalidateCacheOnLocalSettingsChange
'wgCacheEpoch' => '20140101000000',
// For ResourceLoader::__construct()
'wgResourceLoaderSources' => array(),
// For wfScript()
'wgScriptPath' => '/w',
'wgScriptExtension' => '.php',
'wgScript' => '/w/index.php',
'wgLoadScript' => '/w/load.php',
) );
}
}
/* Stubs */
class ResourceLoaderTestModule extends ResourceLoaderModule {}
class ResourceLoaderFileModuleTestModule extends ResourceLoaderFileModule {}