Merge "Allow local interwiki links with an empty title part"
[lhc/web/wiklou.git] / tests / phpunit / ResourceLoaderTestCase.php
1 <?php
2
3 abstract class ResourceLoaderTestCase extends MediaWikiTestCase {
4 protected static function getResourceLoaderContext() {
5 $resourceLoader = new ResourceLoader();
6 $request = new FauxRequest( array(
7 'lang' => 'en',
8 'modules' => 'startup',
9 'only' => 'scripts',
10 'skin' => 'vector',
11 'target' => 'test',
12 ) );
13 return new ResourceLoaderContext( $resourceLoader, $request );
14 }
15
16 protected function setUp() {
17 parent::setUp();
18
19 ResourceLoader::clearCache();
20
21 $this->setMwGlobals( array(
22 // For ResourceLoader::inDebugMode since it doesn't have context
23 'wgResourceLoaderDebug' => true,
24
25 // Avoid influence from wgInvalidateCacheOnLocalSettingsChange
26 'wgCacheEpoch' => '20140101000000',
27
28 // For ResourceLoader::__construct()
29 'wgResourceLoaderSources' => array(),
30
31 // For wfScript()
32 'wgScriptPath' => '/w',
33 'wgScriptExtension' => '.php',
34 'wgScript' => '/w/index.php',
35 'wgLoadScript' => '/w/load.php',
36 ) );
37 }
38 }
39
40 /* Stubs */
41
42 class ResourceLoaderTestModule extends ResourceLoaderModule {
43 protected $dependencies = array();
44 protected $group = null;
45 protected $source = 'local';
46 protected $skipFunction = null;
47 protected $targets = array( 'test' );
48
49 public function __construct( $options = array() ) {
50 foreach ( $options as $key => $value ) {
51 $this->$key = $value;
52 }
53 }
54
55 public function getDependencies() {
56 return $this->dependencies;
57 }
58
59 public function getGroup() {
60 return $this->group;
61 }
62
63 public function getSource() {
64 return $this->source;
65 }
66
67 public function getSkipFunction() {
68 return $this->skipFunction;
69 }
70 }
71
72 class ResourceLoaderFileModuleTestModule extends ResourceLoaderFileModule {
73 }