22 $this->assertFileExists( $filename,
23 "File '$resource' referenced by '$module' must exist."
31 $cssText = CSSMin::minify(
$css->cssText );
34 strpos( $cssText,
'@media' ) ===
false,
35 'Stylesheets should not both specify "media" and contain @media'
41 foreach ( $data[
'modules'] as $moduleName => $module ) {
42 $version = $module->getVersionHash( $data[
'context'] );
43 $this->assertEquals( 7, strlen( $version ),
"$moduleName must use ResourceLoader::makeHash" );
60 foreach ( $data[
'modules'] as $moduleName => $module ) {
61 if ( $module->isRaw() ) {
62 $illegalDeps[] = $moduleName;
67 foreach ( $data[
'modules'] as $moduleName => $module ) {
68 foreach ( $illegalDeps as $illegalDep ) {
69 $this->assertNotContains(
71 $module->getDependencies( $data[
'context'] ),
72 "Module '$moduleName' must not depend on '$illegalDep'"
83 $validDeps = array_keys( $data[
'modules'] );
86 foreach ( $data[
'modules'] as $moduleName => $module ) {
87 foreach ( $module->getDependencies( $data[
'context'] ) as $dep ) {
88 $this->assertContains(
91 "The module '$dep' required by '$moduleName' must exist"
102 $lang = Language::factory(
'en' );
105 foreach ( $data[
'modules'] as $moduleName => $module ) {
106 foreach ( $module->getMessages() as $msgKey ) {
108 wfMessage( $msgKey )->useDatabase(
false )->inLanguage(
$lang )->exists(),
109 "Message '$msgKey' required by '$moduleName' must exist"
126 foreach ( $data[
'modules'] as $moduleName => $module ) {
127 $moduleTargets = $module->getTargets();
128 foreach ( $module->getDependencies( $data[
'context'] ) as $dep ) {
129 if ( !isset( $data[
'modules'][$dep] ) ) {
133 $targets = $data[
'modules'][$dep]->getTargets();
134 foreach ( $moduleTargets as $moduleTarget ) {
135 $this->assertContains(
138 "The module '$moduleName' must not have target '$moduleTarget' "
139 .
"because its dependency '$dep' does not have it"
151 $basepath = __DIR__ .
'/../data/css/';
152 $css = file_get_contents( $basepath .
'comments.css' );
153 $files = CSSMin::getLocalFileReferences(
$css, $basepath );
154 $expected = [ $basepath .
'not-commented.gif' ];
158 'Url(...) expression in comment should be omitted.'
179 foreach ( $rl->getModuleNames() as $moduleName ) {
180 $modules[$moduleName] = $rl->getModule( $moduleName );
188 'resourceloader' => $rl,
201 foreach ( $data[
'modules'] as $moduleName => $module ) {
206 $reflectedModule =
new ReflectionObject( $module );
208 $getStyleFiles = $reflectedModule->getMethod(
'getStyleFiles' );
209 $getStyleFiles->setAccessible(
true );
211 $readStyleFile = $reflectedModule->getMethod(
'readStyleFile' );
212 $readStyleFile->setAccessible(
true );
214 $styleFiles = $getStyleFiles->invoke( $module, $data[
'context'] );
216 $flip = $module->getFlip( $data[
'context'] );
218 foreach ( $styleFiles as $media => $files ) {
219 if ( $media && $media !==
'all' ) {
220 foreach ( $files as $file ) {
227 'cssText' => $readStyleFile->invoke(
271 foreach ( $data[
'modules'] as $moduleName => $module ) {
276 $reflectedModule =
new ReflectionObject( $module );
280 foreach ( $filePathProps[
'lists'] as $propName ) {
281 $property = $reflectedModule->getProperty( $propName );
284 foreach ( $list as $key =>
$value ) {
289 if ( is_int( $key ) ) {
297 foreach ( $filePathProps[
'nested-lists'] as $propName ) {
298 $property = $reflectedModule->getProperty( $propName );
301 foreach ( $lists as $list ) {
302 foreach ( $list as $key =>
$value ) {
305 if ( is_int( $key ) ) {
315 $method = $reflectedModule->getMethod(
'getLocalPath' );
316 $method->setAccessible(
true );
319 foreach ( $files as $file ) {
321 $method->invoke( $module, $file ),
328 $module->readStyleFiles(
329 $module->getStyleFiles( $data[
'context'] ),
330 $module->getFlip( $data[
'context'] ),
334 $property = $reflectedModule->getProperty(
'missingLocalFileRefs' );
336 $missingLocalFileRefs =
$property->getValue( $module );
338 foreach ( $missingLocalFileRefs as $file ) {
$wgEnableJavaScriptTest
Allow running of javascript test suites via [[Special:JavaScriptTest]] (such as QUnit).
WebRequest clone which takes values from a provided array.
Object passed around to modules which contains information about the state of a specific loader reque...
ResourceLoader module based on local JavaScript/CSS files.
An object to represent a path to a JavaScript/CSS file, along with a remote and local base path,...
Dynamic JavaScript and CSS resource loading system.
testFileExistence( $filename, $module, $resource)
provideResourceFiles
static getAllModules()
Get all registered modules from ResouceLoader.
testUnsatisfiableDependencies()
Verify that all dependencies of all modules are always satisfiable with the 'targets' defined for the...
testIllegalDependencies()
Verify that nothing explicitly depends on raw modules (such as "query").
static provideMediaStylesheets()
Get all stylesheet files from modules that are an instance of ResourceLoaderFileModule (or one of its...
static provideResourceFiles()
Get all resource files from modules that are an instance of ResourceLoaderFileModule (or one of its s...
testMissingDependencies()
Verify that all modules specified as dependencies of other modules actually exist.
testCommentedLocalFileReferences()
CSSMin::getLocalFileReferences should ignore url(...) expressions that have been commented out.
testStyleMedia( $moduleName, $media, $filename, $css)
provideMediaStylesheets
testMissingMessages()
Verify that all specified messages actually exist.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object
if(!isset( $args[0])) $lang