'deprecated' => true,
],
'deprecatedTomorrow' => $base + [
- 'deprecated' => [
- 'message' => 'Will be removed tomorrow.'
- ],
+ 'deprecated' => 'Will be removed tomorrow.'
],
'htmlTemplateModule' => $base + [
]
],
+ 'htmlTemplateUnknown' => $base + [
+ 'templates' => [
+ 'templates/notfound.html',
+ ]
+ ],
+
'aliasedHtmlTemplateModule' => $base + [
'templates' => [
'foo.html' => 'templates/template.html',
$modules = self::getModules();
$rl = new ResourceLoaderFileModule( $modules[$name] );
$rl->setName( $name );
- $ctx = $this->getResourceLoaderContext( 'en', 'ltr' );
+ $ctx = $this->getResourceLoaderContext();
$this->assertEquals( $rl->getScript( $ctx ), $expected );
}
] );
$expectedModule->setName( 'testing' );
- $contextLtr = $this->getResourceLoaderContext( 'en', 'ltr' );
- $contextRtl = $this->getResourceLoaderContext( 'he', 'rtl' );
+ $contextLtr = $this->getResourceLoaderContext( [
+ 'lang' => 'en',
+ 'dir' => 'ltr',
+ ] );
+ $contextRtl = $this->getResourceLoaderContext( [
+ 'lang' => 'he',
+ 'dir' => 'rtl',
+ ] );
// Since we want to compare the effect of @noflip+@embed against the effect of just @embed, and
// the @noflip annotations are always preserved, we need to strip them first.
'bar.html' => "<div>goodbye</div>\n",
],
],
+ [
+ $modules['htmlTemplateUnknown'],
+ false,
+ ],
];
}
$rl = new ResourceLoaderFileModule( $module );
$rl->setName( 'testing' );
- $this->assertEquals( $rl->getTemplates(), $expected );
+ if ( $expected === false ) {
+ $this->setExpectedException( MWException::class );
+ $rl->getTemplates();
+ } else {
+ $this->assertEquals( $rl->getTemplates(), $expected );
+ }
}
+ /**
+ * @covers ResourceLoaderFileModule::stripBom
+ */
public function testBomConcatenation() {
$basePath = __DIR__ . '/../../data/css';
$testModule = new ResourceLoaderFileModule( [
'File has leading BOM'
);
- $contextLtr = $this->getResourceLoaderContext( 'en', 'ltr' );
+ $context = $this->getResourceLoaderContext();
$this->assertEquals(
- $testModule->getStyles( $contextLtr ),
+ $testModule->getStyles( $context ),
[ 'all' => ".efbbbf_bom_char_at_start_of_file {}\n" ],
'Leading BOM removed when concatenating files'
);