From: jenkins-bot Date: Mon, 14 Dec 2015 00:21:23 +0000 (+0000) Subject: Merge "Set Language in SpecialSearchTest.php" X-Git-Tag: 1.31.0-rc.0~8704 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=7b0d1e1590f87871cb25441e4d20b7c5ae80813e;hp=660bbda5f6146204f530409253f315cb53996446 Merge "Set Language in SpecialSearchTest.php" --- diff --git a/HISTORY b/HISTORY index e9de01ab2c..9cb53999fa 100644 --- a/HISTORY +++ b/HISTORY @@ -246,6 +246,59 @@ changes to languages because of Phabricator reports. == MediaWiki 1.25 == +== MediaWiki 1.25.3 == + +This is a security and maintenance release of the MediaWiki 1.25 branch. + +=== Changes since 1.25.2 === + +* (T98975) Fix having multiple callbacks for a single hook. +* (T107632) maintenance/refreshLinks.php did not always remove all links + pointing to nonexistent pages. +* (T104142) $wgEmergencyContact and $wgPasswordSender now use their default + value if set to an empty string. +* (T62174) Provide fallbacks for use of mb_convert_encoding() in + HtmlFormatter. It was causing an error when accessing the api help page + if the mbstring PHP extension was not installed. +* (T105896) Confirmation emails would sometimes contain invalid codes. +* (T105597) Fixed edit stash inclusion queries. +* (T91850) SECURITY: Add throttle check in ApiUpload and SpecialUpload +* (T91203, T91205) SECURITY: API: Improve validation in chunked uploading +* (T95589) SECURITY: RevDel: Check all revisions for suppression, not just the + first +* (T108616) SECURITY: Avoid exposure of local path in PNG thumbnails + +== MediaWiki 1.25.2 == + +This is a security and maintenance release of the MediaWiki 1.25 branch. + +=== Changes since 1.25.1 === + +* (T94116) SECURITY: Compare API watchlist token in constant time +* (T97391) SECURITY: Escape error message strings in thumb.php +* (T106893) SECURITY: Don't leak autoblocked IP addresses on + Special:DeletedContributions +* (T102562) Fix InstantCommons parameters to handle the new HTTPS-only + policy of Wikimedia Commons. +* (T100767) Setting a configuration setting for skin or extension to + false in LocalSettings.php was not working. +* (T100635) API action=opensearch json output no longer breaks when + $wgDebugToolbar is enabled. +* (T102522) Using an extension.json or skin.json file which has + a "manifest_version" property for 1.26 compatability will no longer + trigger warnings. +* (T86156) Running updateSearchIndex.php will not throw an error as + page_restrictions has been added to the locked table list. +* Special:Version would throw notices if using SVN due to an incorrectly + named variable. Add an additional check that an index is defined. + +== MediaWiki 1.25.1 == + +This is a bug fix release of the MediaWiki 1.25 branch. + +=== Changes since 1.25 === +* (T100351) Fix syntax errors in extension.json of ConfirmEdit extension + === Configuration changes in 1.25 === * $wgPageShowWatchingUsers was removed. * $wgLocalVirtualHosts has been added to replace $wgConf->localVHosts. @@ -792,6 +845,76 @@ For notes on 1.24.x and older releases, see HISTORY. == MediaWiki 1.24 == +== MediaWiki 1.24.4 == + +This is a security and maintenance release of the MediaWiki 1.24 branch. + +== Changes since 1.24.3 == + +* (T91653) Minimal PSR-3 debug logger to support backports from 1.25+. +* (T68650) Fix indexing of moved pages with PostgreSQL. Requires running + update.php to fix. +* (T91850) SECURITY: Add throttle check in ApiUpload and SpecialUpload +* (T91203, T91205) SECURITY: API: Improve validation in chunked uploading +* (T95589) SECURITY: RevDel: Check all revisions for suppression, not just the + first +* (T108616) SECURITY: Avoid exposure of local path in PNG thumbnails + +== MediaWiki 1.24.3 == + +This is a security and maintenance release of the MediaWiki 1.24 branch. + +== Changes since 1.24.2 == + +* (T94116) SECURITY: Compare API watchlist token in constant time +* (T97391) SECURITY: Escape error message strings in thumb.php +* (T106893) SECURITY: Don't leak autoblocked IP addresses on + Special:DeletedContributions +* Update jQuery from v1.11.2 to v1.11.3. +* (T102562) Fix InstantCommons parameters to handle the new HTTPS-only + policy of Wikimedia Commons. + +== MediaWiki 1.24.2 == + +This is a security and maintenance release of the MediaWiki 1.24 branch. + +== Changes since 1.24.1 == + +* (T85848, T71210) SECURITY: Don't parse XMP blocks that contain XML entities, + to prevent various DoS attacks. +* (T85848) SECURITY: Don't allow directly calling Xml::isWellFormed, to reduce + likelihood of DoS. +* (T88310) SECURITY: Always expand xml entities when checking SVG's. +* (T73394) SECURITY: Escape > in Html::expandAttributes to prevent XSS. +* (T85855) SECURITY: Don't execute another user's CSS or JS on preview. +* (T64685) SECURITY: Allow setting maximal password length to prevent DoS when + using PBKDF2. +* (T85349, T85850, T86711) SECURITY: Multiple issues fixed in SVG filtering to + prevent XSS and protect viewer's privacy. +* Fix case of SpecialAllPages/SpecialAllMessages in SpecialPageFactory to fix + loading these special pages when $wgAutoloadAttemptLowercase is false. +* (bug T70087) Fix Special:ActiveUsers page for installations using + PostgreSQL. +* (bug T76254) Fix deleting of pages with PostgreSQL. Requires a schema change + and running update.php to fix. + +== MediaWiki 1.24.1 == + +This is a security and maintenance release of the MediaWiki 1.24 branch. + +== Changes since 1.24.0 == + +* (bug T76686) [SECURITY] thumb.php outputs wikitext message as raw HTML, which + could lead to xss. Permission to edit MediaWiki namespace is required to + exploit this. +* (bug T77028) [SECURITY] Malicious site can bypass CORS restrictions in + $wgCrossSiteAJAXdomains in API calls if it only included an allowed domain as + part of its name. +* (bug T74222) The original patch for T74222 was reverted as unnecessary. +* Fixed a couple of entries in RELEASE-NOTES-1.24. +* (bug T76168) OutputPage: Add accessors for some protected properties. +* (bug T74834) Make 1.24 branch directly installable under PostgreSQL. + === Configuration changes in 1.24 === * MediaWiki will no longer run if register_globals is enabled. It has been deprecated for 5 years now, and was removed in PHP 5.4. For more information @@ -1487,6 +1610,174 @@ of files that are no longer available follows. == MediaWiki 1.23 == +== MediaWiki 1.23.11 == + +This is a security and maintenance release of the MediaWiki 1.23 branch. + +== Changes since 1.23.10 == + +* (T91850) SECURITY: Add throttle check in ApiUpload and SpecialUpload +* (T91203, T91205) SECURITY: API: Improve validation in chunked uploading +* (T108616) SECURITY: Avoid exposure of local path in PNG thumbnails + +== MediaWiki 1.23.10 == + +This is a security and maintenance release of the MediaWiki 1.23 branch. + +== Changes since 1.23.9 == + +* (T94116) SECURITY: Compare API watchlist token in constant time +* (T97391) SECURITY: Escape error message strings in thumb.php +* (T106893) SECURITY: Don't leak autoblocked IP addresses on + Special:DeletedContributions +* (bug 67644) Make AutoLoaderTest handle namespaces +* (T91653) Minimal PSR-3 debug logger to support backports from 1.25+. +* (T102562) Fix InstantCommons parameters to handle the new HTTPS-only + policy of Wikimedia Commons. + +== MediaWiki 1.23.9 == + +This is a security and maintenance release of the MediaWiki 1.23 branch. + +== Changes since 1.23.8 == + +* (T85848, T71210) SECURITY: Don't parse XMP blocks that contain XML entities, + to prevent various DoS attacks. +* (T85848) SECURITY: Don't allow directly calling Xml::isWellFormed, to reduce + likelihood of DoS. +* (T88310) SECURITY: Always expand xml entities when checking SVG's. +* (T73394) SECURITY: Escape > in Html::expandAttributes to prevent XSS. +* (T85855) SECURITY: Don't execute another user's CSS or JS on preview. +* (T85349, T85850, T86711) SECURITY: Multiple issues fixed in SVG filtering to + prevent XSS and protect viewer's privacy. +* (bug T68650) Fix indexing of moved pages with PostgreSQL. Requires running + update.php to fix. +* (bug T70087) Fix Special:ActiveUsers page for installations using + PostgreSQL. + +== MediaWiki 1.23.8 == + +This is a security and maintenance release of the MediaWiki 1.23 branch. + +== Changes since 1.23.7 == + +* (bug T76686) [SECURITY] thumb.php outputs wikitext message as raw HTML, which + could lead to xss. Permission to edit MediaWiki namespace is required to + exploit this. +* (bug T77028) [SECURITY] Malicious site can bypass CORS restrictions in + $wgCrossSiteAJAXdomains in API calls if it only included an allowed domain as + part of its name. +* (bug T74222) The original patch for T74222 was reverted as unnecessary. + +== MediaWiki 1.23.7 == + +This is a security and maintenance release of the MediaWiki 1.23 branch. + +== Changes since 1.23.6 == + +* (bugs 66776, 71478) SECURITY: User PleaseStand reported a way to inject code + into API clients that used format=php to process pages that underwent flash + policy mangling. This was fixed along with improving how the mangling was done + for format=json, and allowing sites to disable the mangling using + $wgMangleFlashPolicy. +* (bug 70901) SECURITY: User Jackmcbarn reported that the ability to update + the content model for a page could allow an unprivileged attacker to edit + another user's common.js under certain circumstances. The user right + "editcontentmodel" was added, and is needed to change a revision's content + model. +* (bug 71111) SECURITY: User PleaseStand reported that on wikis that allow raw + HTML, it is not safe to preview wikitext coming from an untrusted source such + as a cross-site request. Thus add an edit token to the form, and when raw HTML + is allowed, ensure the token is provided before showing the preview. This + check is not performed on wikis that both allow raw HTML and anonymous + editing, since there are easier ways to exploit that scenario. +* (bug 72222) SECURITY: Do not show log action when the entry is revdeleted with + DELETED_ACTION. NOTICE: this may be reverted in a future release pending a + public RFC about the desired functionality. This issue was reported by user + Bawolff. +* (bug 71621) Make allowing site-wide styles on restricted special pages a + config option. +* (bug 42723) Added updated version history from 1.19.2 to 1.22.13 +* $wgMangleFlashPolicy was added to make MediaWiki's mangling of anything that + might be a flash policy directive configurable. + +== MediaWiki 1.23.6 == + +This is a maintenance release of the MediaWiki 1.23 branch. + +=== Changes since 1.23.5 === +* (Bug 72274) Job queue not running (HTTP 411) due to missing + Content-Length: header +* (Bug 67440) Allow classes to be registered properly from installer + +== MediaWiki 1.23.5 == + +This is a security release of the MediaWiki 1.23 branch. + +=== Changes since 1.23.4 === +* (bug 70672) SECURITY: OutputPage: Remove separation of css and js module + allowance. + +== MediaWiki 1.23.4 == + +This is a security and maintenance release of the MediaWiki 1.23 branch. + +=== Changes since 1.23.3 === + +* (bug 69008) SECURITY: Enhance CSS filtering in SVG files. Filter - + diff --git a/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-ltr.svg b/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-ltr.svg index 9b3c1997fb..11b232c7a5 100644 --- a/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-ltr.svg +++ b/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-ltr.svg @@ -1,6 +1,6 @@ - + diff --git a/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-rtl-invert.svg b/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-rtl-invert.svg index 41fe9bd58b..9b6ac9ab95 100644 --- a/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-rtl-invert.svg +++ b/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-rtl-invert.svg @@ -1,6 +1,6 @@ - + diff --git a/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-rtl.svg b/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-rtl.svg index 3201301edb..0679fa2dd7 100644 --- a/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-rtl.svg +++ b/resources/lib/oojs-ui/themes/mediawiki/images/indicators/search-rtl.svg @@ -1,6 +1,6 @@ - + diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index df6fff3552..719eacb3ea 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -19,6 +19,7 @@ * @class jQuery.plugin.suggestions */ + // jscs:disable checkParamNames /** * @method suggestions * @chainable @@ -93,6 +94,7 @@ * @param {boolean} [options.highlightInput=false] Whether to highlight matched portions of the * input or not. */ + // jscs:enable checkParamNames ( function ( $ ) { diff --git a/resources/src/mediawiki.legacy/commonPrint.css b/resources/src/mediawiki.legacy/commonPrint.css index ce565e0066..453d9289e2 100644 --- a/resources/src/mediawiki.legacy/commonPrint.css +++ b/resources/src/mediawiki.legacy/commonPrint.css @@ -18,8 +18,6 @@ div.top, div#column-one, .mw-editsection, .mw-editsection-like, -.toctoggle, -#toc.tochidden, div#f-poweredbyico, div#f-copyrightico, li#about, diff --git a/resources/src/mediawiki.legacy/oldshared.css b/resources/src/mediawiki.legacy/oldshared.css index 66161ed394..77391d74d6 100644 --- a/resources/src/mediawiki.legacy/oldshared.css +++ b/resources/src/mediawiki.legacy/oldshared.css @@ -212,11 +212,6 @@ table.toc td { margin: 0 0 0 2em; } -#toc .toctoggle, -.toc .toctoggle { - font-size: 94%; -} - .error { color: red; font-size: larger; diff --git a/resources/src/mediawiki.legacy/shared.css b/resources/src/mediawiki.legacy/shared.css index 75a091c36d..daebac1441 100644 --- a/resources/src/mediawiki.legacy/shared.css +++ b/resources/src/mediawiki.legacy/shared.css @@ -872,8 +872,6 @@ table.floatleft { } .mw-editsection, -.toctoggle, -.tochidden, #jump-to-nav { -moz-user-select: none; -webkit-user-select: none; diff --git a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.WikitextMessagePoster.js b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.WikitextMessagePoster.js index ad01865620..862454d88b 100644 --- a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.WikitextMessagePoster.js +++ b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.WikitextMessagePoster.js @@ -8,9 +8,10 @@ * * @constructor * @param {mw.Title} title Wikitext page in a talk namespace, to post to + * @param {mw.Api} api mw.Api object to use */ - function WikitextMessagePoster( title ) { - this.api = new mw.Api(); + function WikitextMessagePoster( title, api ) { + this.api = api; this.title = title; } diff --git a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js index 4d0231f3f6..b6dc2b4566 100644 --- a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js +++ b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js @@ -8,7 +8,6 @@ * @singleton */ function MwMessagePosterFactory() { - this.api = new mw.Api(); this.contentModelToClass = {}; } @@ -50,6 +49,7 @@ * API and ResourceLoader requests in the background. * * @param {mw.Title} title Title that will be posted to + * @param {string} [apiUrl] api.php URL if the title is on another wiki * @return {jQuery.Promise} Promise resolving to a mw.messagePoster.MessagePoster. * For failure, rejected with up to three arguments: * @@ -57,11 +57,17 @@ * - error Error explanation * - details Further error details */ - MwMessagePosterFactory.prototype.create = function ( title ) { - var pageId, page, contentModel, moduleName, + MwMessagePosterFactory.prototype.create = function ( title, apiUrl ) { + var pageId, page, contentModel, moduleName, api, factory = this; - return this.api.get( { + if ( apiUrl ) { + api = new mw.ForeignApi( apiUrl ); + } else { + api = mw.Api(); + } + + return api.get( { action: 'query', prop: 'info', indexpageids: true, @@ -76,7 +82,8 @@ return mw.loader.using( moduleName ).then( function () { return factory.createForContentModel( contentModel, - title + title, + api ); }, function () { return $.Deferred().reject( 'failed-to-load-module', 'Failed to load the \'' + moduleName + '\' module' ); @@ -96,11 +103,12 @@ * * @param {string} contentModel Content model of title * @param {mw.Title} title Title being posted to + * @param {mw.Api} api mw.Api instance that the instance should use * @return {mw.messagePoster.MessagePoster} * */ - MwMessagePosterFactory.prototype.createForContentModel = function ( contentModel, title ) { - return new this.contentModelToClass[ contentModel ]( title ); + MwMessagePosterFactory.prototype.createForContentModel = function ( contentModel, title, api ) { + return new this.contentModelToClass[ contentModel ]( title, api ); }; mw.messagePoster = { diff --git a/resources/src/mediawiki.skinning/content.css b/resources/src/mediawiki.skinning/content.css index 4399f3e7d4..b069e50463 100644 --- a/resources/src/mediawiki.skinning/content.css +++ b/resources/src/mediawiki.skinning/content.css @@ -82,11 +82,6 @@ table.toc td { margin: 0 0 0 2em; } -#toc .toctoggle, -.toc .toctoggle { - font-size: 94%; -} - /* Separate columns for tocnumber and toctext */ /* Ignored by IE7 and lower */ .tocnumber, diff --git a/resources/src/mediawiki/api.js b/resources/src/mediawiki/api.js index c26dd6ae12..10e0c56387 100644 --- a/resources/src/mediawiki/api.js +++ b/resources/src/mediawiki/api.js @@ -368,6 +368,8 @@ */ badToken: function ( type ) { var promiseGroup = promises[ this.defaults.ajax.url ]; + + type = mapLegacyToken( type ); if ( promiseGroup ) { delete promiseGroup[ type + 'Token' ]; } diff --git a/resources/src/mediawiki/mediawiki.feedback.js b/resources/src/mediawiki/mediawiki.feedback.js index ebf0e7d0d4..7afb9d3043 100644 --- a/resources/src/mediawiki/mediawiki.feedback.js +++ b/resources/src/mediawiki/mediawiki.feedback.js @@ -38,6 +38,7 @@ * @param {Object} [config] Configuration object * @cfg {mw.Title} [title="Feedback"] The title of the page where you collect * feedback. + * @cfg {string} [apiUrl] api.php URL if the feedback page is on another wiki * @cfg {string} [dialogTitleMessageKey="feedback-dialog-title"] Message key for the * title of the dialog box * @cfg {mw.Uri|string} [bugsLink="//phabricator.wikimedia.org/maniphest/task/create/"] URL where @@ -57,7 +58,7 @@ // Feedback page title this.feedbackPageTitle = config.title || new mw.Title( 'Feedback' ); - this.messagePosterPromise = mw.messagePoster.factory.create( this.feedbackPageTitle ); + this.messagePosterPromise = mw.messagePoster.factory.create( this.feedbackPageTitle, config.apiUrl ); // Links this.bugsTaskSubmissionLink = config.bugsLink || '//phabricator.wikimedia.org/maniphest/task/create/'; diff --git a/resources/src/mediawiki/mediawiki.toc.css b/resources/src/mediawiki/mediawiki.toc.css new file mode 100644 index 0000000000..835a4516bf --- /dev/null +++ b/resources/src/mediawiki/mediawiki.toc.css @@ -0,0 +1,11 @@ +.tochidden, +.toctoggle { + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.toctoggle { + font-size: 94%; +} diff --git a/resources/src/mediawiki/mediawiki.toc.print.css b/resources/src/mediawiki/mediawiki.toc.print.css new file mode 100644 index 0000000000..da2c08fd91 --- /dev/null +++ b/resources/src/mediawiki/mediawiki.toc.print.css @@ -0,0 +1,4 @@ +#toc.tochidden, +.toctoggle { + display: none; +} diff --git a/resources/src/mediawiki/page/image-pagination.js b/resources/src/mediawiki/page/image-pagination.js index 77fed2ce71..a097b1796f 100644 --- a/resources/src/mediawiki/page/image-pagination.js +++ b/resources/src/mediawiki/page/image-pagination.js @@ -119,7 +119,7 @@ } $( function () { - if ( mw.config.get( 'wgNamespaceNumber' ) !== mw.config.get( 'wgNamespaceIds' ).file ) { + if ( mw.config.get( 'wgCanonicalNamespace' ) !== 'File' ) { return; } $multipageimage = $( 'table.multipageimage' ); diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 58860e98fe..c456fcb9de 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -26339,3 +26339,12 @@ Empty LI (T49673)
  • b
  • !! end + +!! test +reserved data attributes stripped +!! wikitext +
    d
    +!! html +
    d
    + +!! end diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 9e4a984653..fc2f743e12 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -520,10 +520,17 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * @since 1.21 */ public static function teardownTestDB() { + global $wgJobClasses; + if ( !self::$dbSetup ) { return; } + foreach ( $wgJobClasses as $type => $class ) { + // Delete any jobs under the clone DB (or old prefix in other stores) + JobQueueGroup::singleton()->get( $type )->delete(); + } + CloneDatabase::changePrefix( self::$oldTablePrefix ); self::$oldTablePrefix = false; diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index 7b60fb3f74..46ec6bcfeb 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -21,7 +21,6 @@ class ExtraParserTest extends MediaWikiTestCase { 'wgLanguageCode' => 'en', 'wgContLang' => $contLang, 'wgLang' => Language::factory( 'en' ), - 'wgMemc' => new EmptyBagOStuff, 'wgCleanSignatures' => true, ) ); diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 5f21e07186..f5ef0162d0 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -375,7 +375,6 @@ class NullMessageBlobStore extends MessageBlobStore { } public function updateModule( $name, ResourceLoaderModule $module, $lang ) { - return; } public function updateMessage( $key ) { diff --git a/tests/phpunit/includes/TemplateParserTest.php b/tests/phpunit/includes/TemplateParserTest.php index 3b37f4a46a..ddef24aae9 100644 --- a/tests/phpunit/includes/TemplateParserTest.php +++ b/tests/phpunit/includes/TemplateParserTest.php @@ -12,7 +12,6 @@ class TemplateParserTest extends MediaWikiTestCase { $this->setMwGlobals( array( 'wgSecretKey' => 'foo', - 'wgMemc' => new EmptyBagOStuff(), ) ); $this->templateDir = dirname( __DIR__ ) . '/data/templates/'; diff --git a/tests/phpunit/includes/TitlePermissionTest.php b/tests/phpunit/includes/TitlePermissionTest.php index 1318d104c1..4dc83507c9 100644 --- a/tests/phpunit/includes/TitlePermissionTest.php +++ b/tests/phpunit/includes/TitlePermissionTest.php @@ -31,7 +31,6 @@ class TitlePermissionTest extends MediaWikiLangTestCase { $localOffset = date( 'Z' ) / 60; $this->setMwGlobals( array( - 'wgMemc' => new EmptyBagOStuff, 'wgContLang' => $langObj, 'wgLanguageCode' => 'en', 'wgLang' => $langObj, diff --git a/tests/phpunit/includes/api/ApiErrorFormatterTest.php b/tests/phpunit/includes/api/ApiErrorFormatterTest.php index 3e5f3555c6..a08a86ef3a 100644 --- a/tests/phpunit/includes/api/ApiErrorFormatterTest.php +++ b/tests/phpunit/includes/api/ApiErrorFormatterTest.php @@ -3,7 +3,7 @@ /** * @group API */ -class ApiErrorFormatterTest extends MediaWikiTestCase { +class ApiErrorFormatterTest extends MediaWikiLangTestCase { /** * @covers ApiErrorFormatter diff --git a/tests/phpunit/includes/api/ApiResultTest.php b/tests/phpunit/includes/api/ApiResultTest.php index d43db71421..9dbde3d93f 100644 --- a/tests/phpunit/includes/api/ApiResultTest.php +++ b/tests/phpunit/includes/api/ApiResultTest.php @@ -458,6 +458,13 @@ class ApiResultTest extends MediaWikiTestCase { ); } + // Add two values and some metadata, but ensure metadata is not counted + $result = new ApiResult( 100 ); + $obj = array( 'attr' => '12345' ); + ApiResult::setContentValue( $obj, 'content', '1234567890' ); + $this->assertTrue( $result->addValue( null, 'foo', $obj ) ); + $this->assertSame( 15, $result->getSize() ); + $result = new ApiResult( 10 ); $formatter = new ApiErrorFormatter( $result, Language::factory( 'en' ), 'none', false ); $result->setErrorFormatter( $formatter ); diff --git a/tests/phpunit/includes/api/ApiTestCase.php b/tests/phpunit/includes/api/ApiTestCase.php index 21345ac1ff..01113a6412 100644 --- a/tests/phpunit/includes/api/ApiTestCase.php +++ b/tests/phpunit/includes/api/ApiTestCase.php @@ -37,7 +37,6 @@ abstract class ApiTestCase extends MediaWikiLangTestCase { ); $this->setMwGlobals( array( - 'wgMemc' => new EmptyBagOStuff(), 'wgAuth' => new StubObject( 'wgAuth', 'AuthPlugin' ), 'wgRequest' => new FauxRequest( array() ), 'wgUser' => self::$users['sysop']->user, diff --git a/tests/phpunit/includes/content/CssContentHandlerTest.php b/tests/phpunit/includes/content/CssContentHandlerTest.php index 58735bcefb..4da82745c5 100644 --- a/tests/phpunit/includes/content/CssContentHandlerTest.php +++ b/tests/phpunit/includes/content/CssContentHandlerTest.php @@ -1,6 +1,6 @@ assertFalse( $this->db->tableExists( 'foobarbaz' ) ); $this->assertInternalType( 'int', $res->numRows() ); } + + public function testTransactionIdle() { + $db = $this->db; + + $db->setFlag( DBO_TRX ); + $flagSet = null; + $db->onTransactionIdle( function() use ( $db, &$flagSet ) { + $flagSet = $db->getFlag( DBO_TRX ); + } ); + $this->assertFalse( $flagSet, 'DBO_TRX off in callback' ); + $this->assertTrue( $db->getFlag( DBO_TRX ), 'DBO_TRX restored to default' ); + + $db->clearFlag( DBO_TRX ); + $flagSet = null; + $db->onTransactionIdle( function() use ( $db, &$flagSet ) { + $flagSet = $db->getFlag( DBO_TRX ); + } ); + $this->assertFalse( $flagSet, 'DBO_TRX off in callback' ); + $this->assertFalse( $db->getFlag( DBO_TRX ), 'DBO_TRX restored to default' ); + + $db->clearFlag( DBO_TRX ); + $db->onTransactionIdle( function() use ( $db ) { + $db->setFlag( DBO_TRX ); + } ); + $this->assertFalse( $db->getFlag( DBO_TRX ), 'DBO_TRX restored to default' ); + } } diff --git a/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php b/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php new file mode 100644 index 0000000000..de77ad5071 --- /dev/null +++ b/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php @@ -0,0 +1,25 @@ +setMwGlobals( 'wgCommandLineMode', false ); + + $urls1 = array(); + $title = Title::newMainPage(); + $urls1[] = $title->getCanonicalURL( '?x=1' ); + $urls1[] = $title->getCanonicalURL( '?x=2' ); + $urls1[] = $title->getCanonicalURL( '?x=3' ); + $update1 = new CdnCacheUpdate( $urls1 ); + DeferredUpdates::addUpdate( $update1 ); + + $urls2 = array(); + $urls2[] = $title->getCanonicalURL( '?x=2' ); + $urls2[] = $title->getCanonicalURL( '?x=3' ); + $urls2[] = $title->getCanonicalURL( '?x=4' ); + $update2 = new CdnCacheUpdate( $urls2 ); + DeferredUpdates::addUpdate( $update2 ); + + $wrapper = TestingAccessWrapper::newFromObject( $update1 ); + $this->assertEquals( array_merge( $urls1, $urls2 ), $wrapper->urls ); + } +} diff --git a/tests/phpunit/includes/deferred/LinksUpdateTest.php b/tests/phpunit/includes/deferred/LinksUpdateTest.php index c8b4bdaac0..016a7aaed8 100644 --- a/tests/phpunit/includes/deferred/LinksUpdateTest.php +++ b/tests/phpunit/includes/deferred/LinksUpdateTest.php @@ -5,7 +5,8 @@ * @group Database * ^--- make sure temporary tables are used. */ -class LinksUpdateTest extends MediaWikiTestCase { +class LinksUpdateTest extends MediaWikiLangTestCase { + protected $testingPageId; function __construct( $name = null, array $data = array(), $dataName = '' ) { parent::__construct( $name, $data, $dataName ); @@ -45,7 +46,8 @@ class LinksUpdateTest extends MediaWikiTestCase { } public function addDBData() { - $this->insertPage( 'Testing' ); + $res = $this->insertPage( 'Testing' ); + $this->testingPageId = $res['id']; $this->insertPage( 'Some_other_page' ); $this->insertPage( 'Template:TestingTemplate' ); } @@ -64,8 +66,9 @@ class LinksUpdateTest extends MediaWikiTestCase { * @covers ParserOutput::addLink */ public function testUpdate_pagelinks() { + /** @var Title $t */ /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 ); + list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId ); $po->addLink( Title::newFromText( "Foo" ) ); $po->addLink( Title::newFromText( "Special:Foo" ) ); // special namespace should be ignored @@ -78,7 +81,7 @@ class LinksUpdateTest extends MediaWikiTestCase { 'pagelinks', 'pl_namespace, pl_title', - 'pl_from = 111', + 'pl_from = ' . $this->testingPageId, array( array( NS_MAIN, 'Foo' ) ) ); $this->assertArrayEquals( array( @@ -97,7 +100,7 @@ class LinksUpdateTest extends MediaWikiTestCase { 'pagelinks', 'pl_namespace, pl_title', - 'pl_from = 111', + 'pl_from = ' . $this->testingPageId, array( array( NS_MAIN, 'Bar' ), array( NS_TALK, 'Bar' ), @@ -117,13 +120,20 @@ class LinksUpdateTest extends MediaWikiTestCase { */ public function testUpdate_externallinks() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 ); + list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId ); $po->addExternalLink( "http://testing.com/wiki/Foo" ); - $this->assertLinksUpdate( $t, $po, 'externallinks', 'el_to, el_index', 'el_from = 111', array( - array( 'http://testing.com/wiki/Foo', 'http://com.testing./wiki/Foo' ), - ) ); + $this->assertLinksUpdate( + $t, + $po, + 'externallinks', + 'el_to, el_index', + 'el_from = ' . $this->testingPageId, + array( + array( 'http://testing.com/wiki/Foo', 'http://com.testing./wiki/Foo' ), + ) + ); } /** @@ -133,13 +143,18 @@ class LinksUpdateTest extends MediaWikiTestCase { /** @var ParserOutput $po */ $this->setMwGlobals( 'wgCategoryCollation', 'uppercase' ); - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 ); + list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId ); $po->addCategory( "Foo", "FOO" ); - $this->assertLinksUpdate( $t, $po, 'categorylinks', 'cl_to, cl_sortkey', 'cl_from = 111', array( - array( 'Foo', "FOO\nTESTING" ), - ) ); + $this->assertLinksUpdate( + $t, + $po, + 'categorylinks', + 'cl_to, cl_sortkey', + 'cl_from = ' . $this->testingPageId, + array( array( 'Foo', "FOO\nTESTING" ) ) + ); } public function testOnAddingAndRemovingCategory_recentChangesRowIsAdded() { @@ -217,14 +232,19 @@ class LinksUpdateTest extends MediaWikiTestCase { */ public function testUpdate_iwlinks() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 ); + list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId ); $target = Title::makeTitleSafe( NS_MAIN, "Foo", '', 'linksupdatetest' ); $po->addInterwikiLink( $target ); - $this->assertLinksUpdate( $t, $po, 'iwlinks', 'iwl_prefix, iwl_title', 'iwl_from = 111', array( - array( 'linksupdatetest', 'Foo' ), - ) ); + $this->assertLinksUpdate( + $t, + $po, + 'iwlinks', + 'iwl_prefix, iwl_title', + 'iwl_from = ' . $this->testingPageId, + array( array( 'linksupdatetest', 'Foo' ) ) + ); } /** @@ -232,7 +252,7 @@ class LinksUpdateTest extends MediaWikiTestCase { */ public function testUpdate_templatelinks() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 ); + list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId ); $po->addTemplate( Title::newFromText( "Template:Foo" ), 23, 42 ); @@ -242,7 +262,7 @@ class LinksUpdateTest extends MediaWikiTestCase { 'templatelinks', 'tl_namespace, tl_title', - 'tl_from = 111', + 'tl_from = ' . $this->testingPageId, array( array( NS_TEMPLATE, 'Foo' ) ) ); } @@ -252,13 +272,18 @@ class LinksUpdateTest extends MediaWikiTestCase { */ public function testUpdate_imagelinks() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 ); + list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId ); $po->addImage( "Foo.png" ); - $this->assertLinksUpdate( $t, $po, 'imagelinks', 'il_to', 'il_from = 111', array( - array( 'Foo.png' ), - ) ); + $this->assertLinksUpdate( + $t, + $po, + 'imagelinks', + 'il_to', + 'il_from = ' . $this->testingPageId, + array( array( 'Foo.png' ) ) + ); } /** @@ -270,13 +295,18 @@ class LinksUpdateTest extends MediaWikiTestCase { ) ); /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 ); + list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId ); $po->addLanguageLink( Title::newFromText( "en:Foo" )->getFullText() ); - $this->assertLinksUpdate( $t, $po, 'langlinks', 'll_lang, ll_title', 'll_from = 111', array( - array( 'En', 'Foo' ), - ) ); + $this->assertLinksUpdate( + $t, + $po, + 'langlinks', + 'll_lang, ll_title', + 'll_from = ' . $this->testingPageId, + array( array( 'En', 'Foo' ) ) + ); } /** @@ -286,7 +316,7 @@ class LinksUpdateTest extends MediaWikiTestCase { global $wgPagePropsHaveSortkey; /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 ); + list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId ); $fields = array( 'pp_propname', 'pp_value' ); $expected = array(); @@ -318,7 +348,8 @@ class LinksUpdateTest extends MediaWikiTestCase { } } - $this->assertLinksUpdate( $t, $po, 'page_props', $fields, 'pp_page = 111', $expected ); + $this->assertLinksUpdate( + $t, $po, 'page_props', $fields, 'pp_page = ' . $this->testingPageId, $expected ); } public function testUpdate_page_props_without_sortkey() { diff --git a/tests/phpunit/includes/deferred/SquidUpdateTest.php b/tests/phpunit/includes/deferred/SquidUpdateTest.php deleted file mode 100644 index 6ceb42c116..0000000000 --- a/tests/phpunit/includes/deferred/SquidUpdateTest.php +++ /dev/null @@ -1,25 +0,0 @@ -setMwGlobals( 'wgCommandLineMode', false ); - - $urls1 = array(); - $title = Title::newMainPage(); - $urls1[] = $title->getCanonicalURL( '?x=1' ); - $urls1[] = $title->getCanonicalURL( '?x=2' ); - $urls1[] = $title->getCanonicalURL( '?x=3' ); - $update1 = new SquidUpdate( $urls1 ); - DeferredUpdates::addUpdate( $update1 ); - - $urls2 = array(); - $urls2[] = $title->getCanonicalURL( '?x=2' ); - $urls2[] = $title->getCanonicalURL( '?x=3' ); - $urls2[] = $title->getCanonicalURL( '?x=4' ); - $update2 = new SquidUpdate( $urls2 ); - DeferredUpdates::addUpdate( $update2 ); - - $wrapper = TestingAccessWrapper::newFromObject( $update1 ); - $this->assertEquals( array_merge( $urls1, $urls2 ), $wrapper->urls ); - } -} diff --git a/tests/phpunit/includes/jobqueue/JobQueueTest.php b/tests/phpunit/includes/jobqueue/JobQueueTest.php index 9808a55bd5..47277d9676 100644 --- a/tests/phpunit/includes/jobqueue/JobQueueTest.php +++ b/tests/phpunit/includes/jobqueue/JobQueueTest.php @@ -19,8 +19,6 @@ class JobQueueTest extends MediaWikiTestCase { global $wgJobTypeConf; parent::setUp(); - $this->setMwGlobals( 'wgMemc', new HashBagOStuff() ); - if ( $this->getCliArg( 'use-jobqueue' ) ) { $name = $this->getCliArg( 'use-jobqueue' ); if ( !isset( $wgJobTypeConf[$name] ) ) { @@ -43,9 +41,6 @@ class JobQueueTest extends MediaWikiTestCase { foreach ( $variants as $q => $settings ) { try { $this->$q = JobQueue::factory( $settings + $baseConfig ); - if ( !( $this->$q instanceof JobQueueDB ) ) { - $this->$q->setTestingPrefix( 'unittests-' . wfRandomString( 32 ) ); - } } catch ( MWException $e ) { // unsupported? // @todo What if it was another error? @@ -334,6 +329,30 @@ class JobQueueTest extends MediaWikiTestCase { $this->assertEquals( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" ); } + /** + * @covers JobQueue + */ + public function testQueueAggregateTable() { + $queue = $this->queueFifo; + if ( !$queue || !method_exists( $queue, 'getServerQueuesWithJobs' ) ) { + $this->markTestSkipped(); + } + + $this->assertNotContains( + array( $queue->getType(), $queue->getWiki() ), + $queue->getServerQueuesWithJobs(), + "Null queue not in listing" + ); + + $queue->push( $this->newJob( 0 ) ); + + $this->assertContains( + array( $queue->getType(), $queue->getWiki() ), + $queue->getServerQueuesWithJobs(), + "Null queue in listing" + ); + } + public static function provider_queueLists() { return array( array( 'queueRand', false, 'Random queue without ack()' ), diff --git a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php index 3de315a51a..776538a0bd 100644 --- a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php +++ b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php @@ -1,12 +1,31 @@ wanCache = $this->getMockBuilder( 'WANObjectCache' ) + ->setConstructorArgs( array( array( + 'cache' => new HashBagOStuff(), + 'pool' => 'test', + 'relayer' => new EventRelayerNull( array() ) + ) ) ) + ->setMethods( array( 'makePurgeValue' ) ) + ->getMock(); + + $this->wanCache->expects( $this->any() ) + ->method( 'makePurgeValue' ) + ->will( $this->returnCallback( function ( $timestamp, $holdoff ) { + // Disable holdoff as it messes with testing + return WANObjectCache::PURGE_VAL_PREFIX . (float)$timestamp . ':0'; + } ) ); + } protected function makeBlobStore( $methods = null, $rl = null ) { $blobStore = $this->getMockBuilder( 'MessageBlobStore' ) @@ -14,6 +33,8 @@ class MessageBlobStoreTest extends ResourceLoaderTestCase { ->setMethods( $methods ) ->getMock(); + $access = TestingAccessWrapper::newFromObject( $blobStore ); + $access->wanCache = $this->wanCache; return $blobStore; } @@ -67,9 +88,9 @@ class MessageBlobStoreTest extends ResourceLoaderTestCase { $rl = new ResourceLoader(); $rl->register( $module->getName(), $module ); $blobStore = $this->makeBlobStore( array( 'fetchMessage' ), $rl ); - $blobStore->expects( $this->exactly( 2 ) ) + $blobStore->expects( $this->once() ) ->method( 'fetchMessage' ) - ->will( $this->onConsecutiveCalls( 'First', 'Second' ) ); + ->will( $this->returnValue( 'First' ) ); $blob = $blobStore->getBlob( $module, 'en' ); $this->assertEquals( '{"example":"First"}', $blob, 'Generated blob' ); @@ -80,9 +101,9 @@ class MessageBlobStoreTest extends ResourceLoaderTestCase { $rl = new ResourceLoader(); $rl->register( $module->getName(), $module ); $blobStore = $this->makeBlobStore( array( 'fetchMessage' ), $rl ); - $blobStore->expects( $this->never() ) + $blobStore->expects( $this->once() ) ->method( 'fetchMessage' ) - ->will( $this->returnValue( 'Wrong' ) ); + ->will( $this->returnValue( 'Second' ) ); $blob = $blobStore->getBlob( $module, 'en' ); $this->assertEquals( '{"example":"Second"}', $blob, 'Updated blob' ); @@ -122,4 +143,25 @@ class MessageBlobStoreTest extends ResourceLoaderTestCase { $blob = $blobStore->getBlob( $module, 'en' ); $this->assertEquals( '{"foo":"Hello","bar":"World"}', $blob, 'Updated blob' ); } + + public function testClear() { + $module = $this->makeModule( array( 'example' ) ); + $rl = new ResourceLoader(); + $rl->register( $module->getName(), $module ); + $blobStore = $this->makeBlobStore( array( 'fetchMessage' ), $rl ); + $blobStore->expects( $this->exactly( 2 ) ) + ->method( 'fetchMessage' ) + ->will( $this->onConsecutiveCalls( 'First', 'Second' ) ); + + $blob = $blobStore->getBlob( $module, 'en' ); + $this->assertEquals( '{"example":"First"}', $blob, 'Generated blob' ); + + $blob = $blobStore->getBlob( $module, 'en' ); + $this->assertEquals( '{"example":"First"}', $blob, 'Cache-hit' ); + + $blobStore->clear(); + + $blob = $blobStore->getBlob( $module, 'en' ); + $this->assertEquals( '{"example":"Second"}', $blob, 'Updated blob' ); + } } diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php index f700348348..3f2a5e2558 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php @@ -4,7 +4,6 @@ class ResourceLoaderModuleTest extends ResourceLoaderTestCase { /** * @covers ResourceLoaderModule::getVersionHash - * @group Broken */ public function testGetVersionHash() { $context = $this->getResourceLoaderContext(); @@ -69,6 +68,8 @@ class ResourceLoaderModuleTest extends ResourceLoaderTestCase { * @covers ResourceLoaderModule::validateScriptFile */ public function testValidateScriptFile() { + $this->setMwGlobals( 'wgResourceLoaderValidateJS', true ); + $context = $this->getResourceLoaderContext(); $module = new ResourceLoaderTestModule( array( diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php index c552b807bc..9a36d1848f 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php @@ -5,7 +5,7 @@ class ResourceLoaderStartUpModuleTest extends ResourceLoaderTestCase { // Version hash for a blank file module. // Result of ResourceLoader::makeHash(), ResourceLoaderTestModule // and ResourceLoaderFileModule::getDefinitionSummary(). - protected static $blankVersion = 'wvTifjse'; + protected static $blankVersion = 'GqV9IPpY'; protected static function expandPlaceholders( $text ) { return strtr( $text, array( diff --git a/tests/phpunit/languages/LanguageConverterTest.php b/tests/phpunit/languages/LanguageConverterTest.php index d4ccca99c0..8fc0beedb6 100644 --- a/tests/phpunit/languages/LanguageConverterTest.php +++ b/tests/phpunit/languages/LanguageConverterTest.php @@ -13,7 +13,6 @@ class LanguageConverterTest extends MediaWikiLangTestCase { 'wgContLang' => Language::factory( 'tg' ), 'wgLanguageCode' => 'tg', 'wgDefaultLanguageVariant' => false, - 'wgMemc' => new EmptyBagOStuff, 'wgRequest' => new FauxRequest( array() ), 'wgUser' => new User, ) ); diff --git a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.test.js b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.test.js index a34a5af996..394f3bd56b 100644 --- a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.test.js +++ b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.test.js @@ -220,6 +220,30 @@ } ); + QUnit.test( 'badToken( legacy )', function ( assert ) { + QUnit.expect( 2 ); + var api = new mw.Api( { ajax: { url: '/badTokenLegacy/api.php' } } ), + test = this; + + this.server.respondWith( /type=csrf/, sequenceBodies( 200, { 'Content-Type': 'application/json' }, + [ + '{ "query": { "tokens": { "csrftoken": "badlegacy" } } }', + '{ "query": { "tokens": { "csrftoken": "goodlegacy" } } }' + ] + ) ); + + api.getToken( 'options' ) + .then( function () { + api.badToken( 'options' ); + return api.getToken( 'options' ); + } ) + .then( function ( token ) { + assert.equal( token, 'goodlegacy', 'The token' ); + assert.equal( test.server.requests.length, 2, 'Request made' ); + } ); + + } ); + QUnit.test( 'postWithToken( tokenType, params )', function ( assert ) { QUnit.expect( 1 ); var api = new mw.Api( { ajax: { url: '/postWithToken/api.php' } } );