mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-19 05:15:52 +00:00
1ea31cc003
Changes: * Extract the various shapes of stub user object into the shared mw.popups.tests.stubs#createStubUser factory method. * Register the ext.popups.tests.stubs module in PopupsHooks#onResourceLoaderTestModules and make the test suite depend on it. Bug: T152225 Change-Id: I893b11461d8484bcaabfd950c2fa0dc672454a9d
25 lines
502 B
JavaScript
25 lines
502 B
JavaScript
( function ( mw ) {
|
|
|
|
/**
|
|
* Creates a **minimal** stub that can be used in place of an `mw.User`
|
|
* instance.
|
|
*
|
|
* @param {boolean} isAnon The return value of the `#isAnon`.
|
|
* @return {Object}
|
|
*/
|
|
mw.popups.tests.stubs.createStubUser = function createStubUser( isAnon ) {
|
|
return {
|
|
isAnon: function () {
|
|
return isAnon;
|
|
},
|
|
sessionId: function () {
|
|
return '0123456789';
|
|
},
|
|
generateRandomSessionId: function () {
|
|
return '9876543210';
|
|
}
|
|
};
|
|
};
|
|
|
|
}( mediaWiki ) );
|