MediaWiki  REL1_22
load.mock.php
Go to the documentation of this file.
00001 <?php
00025 header( 'Content-Type: text/javascript; charset=utf-8' );
00026 
00027 require_once __DIR__ . '/../../../includes/json/FormatJson.php';
00028 require_once __DIR__ . '/../../../includes/Xml.php';
00029 
00030 $moduleImplementations = array(
00031     'testUsesMissing' => "
00032 mw.loader.implement( 'testUsesMissing', function () {
00033     QUnit.ok( false, 'Module test.usesMissing script should not run.');
00034     QUnit.start();
00035 }, {}, {});
00036 ",
00037 
00038     'testUsesNestedMissing' => "
00039 mw.loader.implement( 'testUsesNestedMissing', function () {
00040     QUnit.ok( false, 'Module testUsesNestedMissing script should not run.');
00041 }, {}, {});
00042 ",
00043 );
00044 
00045 $response = '';
00046 
00047 // Only support for non-encoded module names, full module names expected
00048 if ( isset( $_GET['modules'] ) ) {
00049     $modules = explode( ',', $_GET['modules'] );
00050     foreach ( $modules as $module ) {
00051         if ( isset( $moduleImplementations[$module] ) ) {
00052             $response .= $moduleImplementations[$module];
00053         } else {
00054             $response .= Xml::encodeJsCall( 'mw.loader.state', array( $module, 'missing' ), true );
00055         }
00056     }
00057 }
00058 
00059 echo $response;