23 $this->assertFileExists( $filename,
24 "File '$resource' referenced by '$module' must exist."
34 $this->assertTrue( strpos( $cssText,
'@media' ) ===
false,
'Stylesheets should not both specify "media" and contain @media' );
39 $illegalDeps =
array(
'jquery',
'mediawiki' );
41 foreach ( $data[
'modules']
as $moduleName => $module ) {
42 foreach ( $illegalDeps
as $illegalDep ) {
43 $this->assertNotContains(
45 $module->getDependencies(),
46 "Module '$moduleName' must not depend on '$illegalDep'"
56 global $wgEnableJavaScriptTest;
60 $org_wgEnableJavaScriptTest = $wgEnableJavaScriptTest;
61 $wgEnableJavaScriptTest =
true;
68 foreach ( $rl->getModuleNames()
as $moduleName ) {
69 $modules[$moduleName] = $rl->getModule( $moduleName );
73 $wgEnableJavaScriptTest = $org_wgEnableJavaScriptTest;
76 'modules' => $modules,
77 'resourceloader' => $rl,
90 foreach ( $data[
'modules']
as $moduleName => $module ) {
95 $reflectedModule =
new ReflectionObject( $module );
97 $getStyleFiles = $reflectedModule->getMethod(
'getStyleFiles' );
98 $getStyleFiles->setAccessible(
true );
100 $readStyleFile = $reflectedModule->getMethod(
'readStyleFile' );
101 $readStyleFile->setAccessible(
true );
103 $styleFiles = $getStyleFiles->invoke( $module, $data[
'context'] );
105 $flip = $module->getFlip( $data[
'context'] );
107 foreach ( $styleFiles
as $media =>
$files ) {
108 if ( $media && $media !==
'all' ) {
115 (
object)
array(
'cssText' => $readStyleFile->invoke( $module,
$file, $flip ) ),
137 $filePathProps =
array(
147 'nested-lists' =>
array(
154 foreach ( $data[
'modules']
as $moduleName => $module ) {
159 $reflectedModule =
new ReflectionObject( $module );
163 foreach ( $filePathProps[
'lists']
as $propName ) {
164 $property = $reflectedModule->getProperty( $propName );
167 foreach ( $list
as $key =>
$value ) {
172 if ( is_int( $key ) ) {
180 foreach ( $filePathProps[
'nested-lists']
as $propName ) {
181 $property = $reflectedModule->getProperty( $propName );
184 foreach ( $lists
as $list ) {
185 foreach ( $list
as $key =>
$value ) {
188 if ( is_int( $key ) ) {
198 $method = $reflectedModule->getMethod(
'getLocalPath' );
199 $method->setAccessible(
true );
204 $method->invoke( $module,
$file ),