4 * @group ResourceLoader
6 class ResourceLoaderFileModuleTest
extends ResourceLoaderTestCase
{
8 protected function setUp() {
11 // The return value of the closure shouldn't matter since this test should
13 SkinFactory
::getDefaultInstance()->register(
21 public static function getModules() {
23 'localBasePath' => realpath( dirname( __FILE__
) ),
27 'noTemplateModule' => array(),
29 'htmlTemplateModule' => $base +
array(
31 'templates/template.html',
32 'templates/template2.html',
36 'aliasedHtmlTemplateModule' => $base +
array(
38 'foo.html' => 'templates/template.html',
39 'bar.html' => 'templates/template2.html',
43 'templateModuleHandlebars' => $base +
array(
45 'templates/template_awesome.handlebars',
51 public static function providerGetTemplates() {
52 $modules = self
::getModules();
56 $modules['noTemplateModule'],
60 $modules['templateModuleHandlebars'],
62 'templates/template_awesome.handlebars' => "wow\n",
66 $modules['htmlTemplateModule'],
68 'templates/template.html' => "<strong>hello</strong>\n",
69 'templates/template2.html' => "<div>goodbye</div>\n",
73 $modules['aliasedHtmlTemplateModule'],
75 'foo.html' => "<strong>hello</strong>\n",
76 'bar.html' => "<div>goodbye</div>\n",
82 public static function providerGetModifiedTime() {
83 $modules = self
::getModules();
86 // Check the default value when no templates present in module is 1
87 array( $modules['noTemplateModule'], 1 ),
92 * @covers ResourceLoaderFileModule::getAllSkinStyleFiles
94 public function testGetAllSkinStyleFiles() {
102 'bar.css' => array( 'media' => 'print' ),
103 'screen.less' => array( 'media' => 'screen' ),
104 'screen-query.css' => array( 'media' => 'screen and (min-width: 400px)' ),
106 'skinStyles' => array(
107 'default' => 'quux-fallback.less',
119 $module = new ResourceLoaderFileModule( $baseParams );
126 'quux-fallback.less',
131 array_map( 'basename', $module->getAllStyleFiles() )
136 * @dataProvider providerGetTemplates
137 * @covers ResourceLoaderFileModule::getTemplates
139 public function testGetTemplates( $module, $expected ) {
140 $rl = new ResourceLoaderFileModule( $module );
142 $this->assertEquals( $rl->getTemplates(), $expected );
146 * @dataProvider providerGetModifiedTime
147 * @covers ResourceLoaderFileModule::getModifiedTime
149 public function testGetModifiedTime( $module, $expected ) {
150 $rl = new ResourceLoaderFileModule( $module );
151 $ts = $rl->getModifiedTime( $this->getResourceLoaderContext() );
152 $this->assertEquals( $ts, $expected );