3 abstract class ResourceLoaderTestCase
extends MediaWikiTestCase
{
4 protected static function getResourceLoaderContext() {
5 $resourceLoader = new ResourceLoader();
6 $request = new FauxRequest( array(
8 'modules' => 'startup',
13 return new ResourceLoaderContext( $resourceLoader, $request );
16 protected function setUp() {
19 ResourceLoader
::clearCache();
21 $this->setMwGlobals( array(
22 // For ResourceLoader::inDebugMode since it doesn't have context
23 'wgResourceLoaderDebug' => true,
25 // Avoid influence from wgInvalidateCacheOnLocalSettingsChange
26 'wgCacheEpoch' => '20140101000000',
28 // For ResourceLoader::__construct()
29 'wgResourceLoaderSources' => array(),
32 'wgScriptPath' => '/w',
33 'wgScriptExtension' => '.php',
34 'wgScript' => '/w/index.php',
35 'wgLoadScript' => '/w/load.php',
42 class ResourceLoaderTestModule
extends ResourceLoaderModule
{
43 protected $dependencies = array();
44 protected $group = null;
45 protected $source = 'local';
46 protected $script = '';
47 protected $styles = '';
48 protected $skipFunction = null;
49 protected $targets = array( 'test' );
51 public function __construct( $options = array() ) {
52 foreach ( $options as $key => $value ) {
57 public function getScript( ResourceLoaderContext
$context ) {
61 public function getStyles( ResourceLoaderContext
$context ) {
62 return array( '' => $this->styles
);
65 public function getDependencies() {
66 return $this->dependencies
;
69 public function getGroup() {
73 public function getSource() {
77 public function getSkipFunction() {
78 return $this->skipFunction
;
82 class ResourceLoaderFileModuleTestModule
extends ResourceLoaderFileModule
{