21 $this->assertFileExists( $filename,
22 "File '$resource' referenced by '$module' must exist."
33 strpos( $cssText,
'@media' ) ===
false,
34 'Stylesheets should not both specify "media" and contain @media'
40 foreach ( $data[
'modules']
as $moduleName => $module ) {
41 $version = $module->getVersionHash( $data[
'context'] );
42 $this->assertEquals( 7, strlen( $version ),
"$moduleName must use ResourceLoader::makeHash" );
55 $illegalDeps = [
'jquery',
'mediawiki' ];
58 foreach ( $data[
'modules']
as $moduleName => $module ) {
59 foreach ( $illegalDeps
as $illegalDep ) {
60 $this->assertNotContains(
62 $module->getDependencies( $data[
'context'] ),
63 "Module '$moduleName' must not depend on '$illegalDep'"
74 $validDeps = array_keys( $data[
'modules'] );
77 foreach ( $data[
'modules']
as $moduleName => $module ) {
78 foreach ( $module->getDependencies( $data[
'context'] )
as $dep ) {
79 $this->assertContains(
82 "The module '$dep' required by '$moduleName' must exist"
96 foreach ( $data[
'modules']
as $moduleName => $module ) {
97 foreach ( $module->getMessages()
as $msgKey ) {
99 wfMessage( $msgKey )->useDatabase(
false )->inLanguage(
$lang )->exists(),
100 "Message '$msgKey' required by '$moduleName' must exist"
117 foreach ( $data[
'modules']
as $moduleName => $module ) {
118 $moduleTargets = $module->getTargets();
119 foreach ( $module->getDependencies( $data[
'context'] )
as $dep ) {
120 if ( !isset( $data[
'modules'][$dep] ) ) {
124 $targets = $data[
'modules'][$dep]->getTargets();
125 foreach ( $moduleTargets
as $moduleTarget ) {
126 $this->assertContains(
129 "The module '$moduleName' must not have target '$moduleTarget' "
130 .
"because its dependency '$dep' does not have it"
142 $basepath = __DIR__ .
'/../data/css/';
143 $css = file_get_contents( $basepath .
'comments.css' );
145 $expected = [ $basepath .
'not-commented.gif' ];
149 'Url(...) expression in comment should be omitted.'
166 $rl =
new ResourceLoader();
170 foreach ( $rl->getModuleNames()
as $moduleName ) {
171 $modules[$moduleName] = $rl->getModule( $moduleName );
179 'resourceloader' => $rl,
192 foreach ( $data[
'modules']
as $moduleName => $module ) {
197 $reflectedModule =
new ReflectionObject( $module );
199 $getStyleFiles = $reflectedModule->getMethod(
'getStyleFiles' );
200 $getStyleFiles->setAccessible(
true );
202 $readStyleFile = $reflectedModule->getMethod(
'readStyleFile' );
203 $readStyleFile->setAccessible(
true );
205 $styleFiles = $getStyleFiles->invoke( $module, $data[
'context'] );
207 $flip = $module->getFlip( $data[
'context'] );
209 foreach ( $styleFiles
as $media => $files ) {
210 if ( $media && $media !==
'all' ) {
211 foreach ( $files
as $file ) {
218 'cssText' => $readStyleFile->invoke(
262 foreach ( $data[
'modules']
as $moduleName => $module ) {
267 $reflectedModule =
new ReflectionObject( $module );
271 foreach ( $filePathProps[
'lists']
as $propName ) {
272 $property = $reflectedModule->getProperty( $propName );
275 foreach ( $list
as $key =>
$value ) {
280 if ( is_int( $key ) ) {
288 foreach ( $filePathProps[
'nested-lists']
as $propName ) {
289 $property = $reflectedModule->getProperty( $propName );
292 foreach ( $lists
as $list ) {
293 foreach ( $list
as $key =>
$value ) {
296 if ( is_int( $key ) ) {
306 $method = $reflectedModule->getMethod(
'getLocalPath' );
307 $method->setAccessible(
true );
310 foreach ( $files
as $file ) {
312 $method->invoke( $module, $file ),
319 $module->readStyleFiles(
320 $module->getStyleFiles( $data[
'context'] ),
321 $module->getFlip( $data[
'context'] ),
325 $property = $reflectedModule->getProperty(
'missingLocalFileRefs' );
327 $missingLocalFileRefs =
$property->getValue( $module );
329 foreach ( $missingLocalFileRefs
as $file ) {