* CommentStore::getCommentLegacy
* CommentStore::insert
* CommentStore::insertWithTemplate
+* The following methods in Title have been renamed, and the old ones are deprecated:
+ * Title::getSkinFromCssJsSubpage – use ::getSkinFromConfigSubpage
+ * Title::isCssOrJsPage – use ::isSiteConfigPage
+ * Title::isCssJsSubpage – use ::isUserConfigPage
+ * Title::isCssSubpage – use ::isUserCssConfigPage
+ * Title::isJsSubpage – use ::isUserJsConfigPage
* The method ResourceLoaderModule::getPosition(), deprecated in 1.29, has been removed.
== Compatibility ==
$wgGrantPermissions['editprotected'] = $wgGrantPermissions['editpage'];
$wgGrantPermissions['editprotected']['editprotected'] = true;
+// FIXME: Rename editmycssjs to editmyconfig
$wgGrantPermissions['editmycssjs'] = $wgGrantPermissions['editpage'];
$wgGrantPermissions['editmycssjs']['editmyusercss'] = true;
$wgGrantPermissions['editmycssjs']['editmyuserjs'] = true;
public $isConflict = false;
/**
- * @deprecated since 1.30 use Title::isCssJsSubpage()
+ * @deprecated since 1.30 use Title::isUserConfigPage()
* @var bool
*/
public $isCssJsSubpage = false;
/**
- * @deprecated since 1.30 use Title::isCssSubpage()
+ * @deprecated since 1.30 use Title::isUserCssConfigPage()
* @var bool
*/
public $isCssSubpage = false;
/**
- * @deprecated since 1.30 use Title::isJsSubpage()
+ * @deprecated since 1.30 use Title::isUserJsConfigPage()
* @var bool
*/
public $isJsSubpage = false;
// css / js subpages of user pages get a special treatment
// The following member variables are deprecated since 1.30,
// the functions should be used instead.
- $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
- $this->isCssSubpage = $this->mTitle->isCssSubpage();
- $this->isJsSubpage = $this->mTitle->isJsSubpage();
- $this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage();
+ $this->isCssJsSubpage = $this->mTitle->isUserConfigPage();
+ $this->isCssSubpage = $this->mTitle->isUserCssConfigPage();
+ $this->isJsSubpage = $this->mTitle->isUserJsConfigPage();
+ $this->isWrongCaseCssJsPage = $this->isWrongCaseUserConfigPage();
# Show applicable editing introductions
if ( $this->formtype == 'initial' || $this->firsttime ) {
*
* @return bool
*/
- protected function isWrongCaseCssJsPage() {
- if ( $this->mTitle->isCssJsSubpage() ) {
- $name = $this->mTitle->getSkinFromCssJsSubpage();
+ protected function isWrongCaseUserConfigPage() {
+ if ( $this->mTitle->isUserConfigPage() ) {
+ $name = $this->mTitle->getSkinFromConfigSubpage();
$skins = array_merge(
array_keys( Skin::getSkinNames() ),
[ 'common' ]
$out->addHTML( $editConflictHelper->getEditFormHtmlBeforeContent() );
}
- if ( !$this->mTitle->isCssJsSubpage() && $showToolbar && $user->getOption( 'showtoolbar' ) ) {
+ if ( !$this->mTitle->isUserConfigPage() && $showToolbar && $user->getOption( 'showtoolbar' ) ) {
$out->addHTML( self::getEditToolbar( $this->mTitle ) );
}
);
}
} else {
- if ( $this->mTitle->isCssJsSubpage() ) {
+ if ( $this->mTitle->isUserConfigPage() ) {
# Check the skin exists
- if ( $this->isWrongCaseCssJsPage() ) {
+ if ( $this->isWrongCaseUserConfigPage() ) {
$out->wrapWikiMsg(
- "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>",
- [ 'userinvalidcssjstitle', $this->mTitle->getSkinFromCssJsSubpage() ]
+ "<div class='error' id='mw-userinvalidconfigtitle'>\n$1\n</div>",
+ [ 'userinvalidconfigtitle', $this->mTitle->getSkinFromConfigSubpage() ]
);
}
if ( $this->getTitle()->isSubpageOf( $user->getUserPage() ) ) {
- $isCssSubpage = $this->mTitle->isCssSubpage();
- $out->wrapWikiMsg( '<div class="mw-usercssjspublic">$1</div>',
- $isCssSubpage ? 'usercssispublic' : 'userjsispublic'
- );
+ $isUserCssConfig = $this->mTitle->isUserCssConfigPage();
+
+ $warning = $isUserCssConfig
+ ? 'usercssispublic'
+ : 'userjsispublic';
+
+ $out->wrapWikiMsg( '<div class="mw-userconfigpublic">$1</div>', $warning );
+
if ( $this->formtype !== 'preview' ) {
$config = $this->context->getConfig();
- if ( $isCssSubpage && $config->get( 'AllowUserCss' ) ) {
+ if ( $isUserCssConfig && $config->get( 'AllowUserCss' ) ) {
$out->wrapWikiMsg(
"<div id='mw-usercssyoucanpreview'>\n$1\n</div>",
[ 'usercssyoucanpreview' ]
}
# don't parse non-wikitext pages, show message about preview
- if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) {
- if ( $this->mTitle->isCssJsSubpage() ) {
+ if ( $this->mTitle->isUserConfigPage() || $this->mTitle->isSiteConfigPage() ) {
+ if ( $this->mTitle->isUserConfigPage() ) {
$level = 'user';
- } elseif ( $this->mTitle->isCssOrJsPage() ) {
+ } elseif ( $this->mTitle->isSiteConfigPage() ) {
$level = 'site';
} else {
$level = false;
private function isUserJsPreview() {
return $this->getConfig()->get( 'AllowUserJs' )
&& $this->getTitle()
- && $this->getTitle()->isJsSubpage()
+ && $this->getTitle()->isUserJsConfigPage()
&& $this->userCanPreview();
}
protected function isUserCssPreview() {
return $this->getConfig()->get( 'AllowUserCss' )
&& $this->getTitle()
- && $this->getTitle()->isCssSubpage()
+ && $this->getTitle()->isUserCssConfigPage()
&& $this->userCanPreview();
}
}
$title = $this->getTitle();
- if ( !$title->isJsSubpage() && !$title->isCssSubpage() ) {
+ if (
+ !$title->isUserJsConfigPage()
+ && !$title->isUserCssConfigPage()
+ ) {
return false;
}
if ( !$title->isSubpageOf( $user->getUserPage() ) ) {
* show "inactive" CSS or JS.
*
* @return bool
- * @todo FIXME: Rename to isSiteConfigPage() and remove deprecated hook
+ * @since 1.31
+ */
+ public function isSiteConfigPage() {
+ return (
+ NS_MEDIAWIKI == $this->mNamespace
+ && (
+ $this->hasContentModel( CONTENT_MODEL_CSS )
+ || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
+ )
+ );
+ }
+
+ /**
+ * @return bool
+ * @deprecated Since 1.31; use ::isSiteConfigPage() instead
*/
public function isCssOrJsPage() {
- $isCssOrJsPage = NS_MEDIAWIKI == $this->mNamespace
- && ( $this->hasContentModel( CONTENT_MODEL_CSS )
- || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) );
+ // wfDeprecated( __METHOD__, '1.31' );
+ return ( NS_MEDIAWIKI == $this->mNamespace
+ && ( $this->hasContentModel( CONTENT_MODEL_CSS )
+ || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) ) );
+ }
- return $isCssOrJsPage;
+ /**
+ * Is this a "config" (.css or .js) sub-page of a user page?
+ *
+ * @return bool
+ * @since 1.31
+ */
+ public function isUserConfigPage() {
+ return (
+ NS_USER == $this->mNamespace
+ && $this->isSubpage()
+ && (
+ $this->hasContentModel( CONTENT_MODEL_CSS )
+ || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
+ )
+ );
}
/**
- * Is this a .css or .js subpage of a user page?
* @return bool
- * @todo FIXME: Rename to isUserConfigPage()
+ * @deprecated Since 1.31; use ::isUserConfigPage() instead
*/
public function isCssJsSubpage() {
+ // wfDeprecated( __METHOD__, '1.31' );
return ( NS_USER == $this->mNamespace && $this->isSubpage()
&& ( $this->hasContentModel( CONTENT_MODEL_CSS )
|| $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) ) );
* Trim down a .css or .js subpage title to get the corresponding skin name
*
* @return string Containing skin name from .css or .js subpage title
+ * @since 1.31
*/
- public function getSkinFromCssJsSubpage() {
+ public function getSkinFromConfigSubpage() {
$subpage = explode( '/', $this->mTextform );
$subpage = $subpage[count( $subpage ) - 1];
$lastdot = strrpos( $subpage, '.' );
}
/**
- * Is this a .css subpage of a user page?
+ * @deprecated Since 1.31; use ::getSkinFromConfigSubpage() instead
+ * @return string Containing skin name from .css or .js subpage title
+ */
+ public function getSkinFromCssJsSubpage() {
+ wfDeprecated( __METHOD__, '1.31' );
+ return $this->getSkinFromConfigSubpage();
+ }
+
+ /**
+ * Is this a CSS "config" sub-page of a user page?
*
* @return bool
+ * @since 1.31
+ */
+ public function isUserCssConfigPage() {
+ return (
+ NS_USER == $this->mNamespace
+ && $this->isSubpage()
+ && $this->hasContentModel( CONTENT_MODEL_CSS )
+ );
+ }
+
+ /**
+ * @deprecated Since 1.31; use ::isUserCssConfigPage()
+ * @return bool
*/
public function isCssSubpage() {
- return ( NS_USER == $this->mNamespace && $this->isSubpage()
- && $this->hasContentModel( CONTENT_MODEL_CSS ) );
+ // wfDeprecated( __METHOD__, '1.31' );
+ return $this->isUserCssConfigPage();
}
/**
* Is this a .js subpage of a user page?
*
* @return bool
+ * @since 1.31
+ */
+ public function isUserJsConfigPage() {
+ return (
+ NS_USER == $this->mNamespace
+ && $this->isSubpage()
+ && $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
+ );
+ }
+
+ /**
+ * @deprecated Since 1.31; use ::isUserCssConfigPage()
+ * @return bool
*/
public function isJsSubpage() {
- return ( NS_USER == $this->mNamespace && $this->isSubpage()
- && $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) );
+ // wfDeprecated( __METHOD__, '1.31' );
+ return $this->isUserJsConfigPage();
}
/**
*
* @return array List of errors
*/
- private function checkCSSandJSPermissions( $action, $user, $errors, $rigor, $short ) {
+ private function checkUserConfigPermissions( $action, $user, $errors, $rigor, $short ) {
# Protect css/js subpages of user pages
# XXX: this might be better using restrictions
+
if ( $action != 'patrol' ) {
if ( preg_match( '/^' . preg_quote( $user->getName(), '/' ) . '\//', $this->mTextform ) ) {
- if ( $this->isCssSubpage() && !$user->isAllowedAny( 'editmyusercss', 'editusercss' ) ) {
+ if (
+ $this->isUserCssConfigPage()
+ && !$user->isAllowedAny( 'editmyusercss', 'editusercss' )
+ ) {
$errors[] = [ 'mycustomcssprotected', $action ];
- } elseif ( $this->isJsSubpage() && !$user->isAllowedAny( 'editmyuserjs', 'edituserjs' ) ) {
+ } elseif (
+ $this->isUserJsConfigPage()
+ && !$user->isAllowedAny( 'editmyuserjs', 'edituserjs' )
+ ) {
$errors[] = [ 'mycustomjsprotected', $action ];
}
} else {
- if ( $this->isCssSubpage() && !$user->isAllowed( 'editusercss' ) ) {
+ if (
+ $this->isUserCssConfigPage()
+ && !$user->isAllowed( 'editusercss' )
+ ) {
$errors[] = [ 'customcssprotected', $action ];
- } elseif ( $this->isJsSubpage() && !$user->isAllowed( 'edituserjs' ) ) {
+ } elseif (
+ $this->isUserJsConfigPage()
+ && !$user->isAllowed( 'edituserjs' )
+ ) {
$errors[] = [ 'customjsprotected', $action ];
}
}
* @return array List of errors
*/
private function checkCascadingSourcesRestrictions( $action, $user, $errors, $rigor, $short ) {
- if ( $rigor !== 'quick' && !$this->isCssJsSubpage() ) {
+ if ( $rigor !== 'quick' && !$this->isUserConfigPage() ) {
# We /could/ use the protection level on the source page, but it's
# fairly ugly as we have to establish a precedence hierarchy for pages
# included by multiple cascade-protected pages. So just restrict
'checkReadPermissions',
'checkUserBlock', // for wgBlockDisablesLogin
];
- # Don't call checkSpecialsAndNSPermissions or checkCSSandJSPermissions
+ # Don't call checkSpecialsAndNSPermissions or checkUserConfigPermissions
# here as it will lead to duplicate error messages. This is okay to do
# since anywhere that checks for create will also check for edit, and
# those checks are called for edit.
'checkQuickPermissions',
'checkPermissionHooks',
'checkSpecialsAndNSPermissions',
- 'checkCSSandJSPermissions',
+ 'checkUserConfigPermissions',
'checkPageRestrictions',
'checkCascadingSourcesRestrictions',
'checkActionPermissions',
}
// If we are looking at a css/js user subpage, purge the action=raw.
- if ( $this->isJsSubpage() ) {
+ if ( $this->isUserJsConfigPage() ) {
$urls[] = $this->getInternalURL( 'action=raw&ctype=text/javascript' );
- } elseif ( $this->isCssSubpage() ) {
+ } elseif ( $this->isUserCssConfigPage() ) {
$urls[] = $this->getInternalURL( 'action=raw&ctype=text/css' );
}
'type' => 'info',
'raw' => true,
'default' => $context->getLanguage()->pipeList( $linkTools ),
- 'label-message' => 'prefs-common-css-js',
+ 'label-message' => 'prefs-common-config',
'section' => 'rendering/skin',
];
}
* Abstraction for ResourceLoader modules which pull from wiki pages
*
* This can only be used for wiki pages in the MediaWiki and User namespaces,
- * because of its dependence on the functionality of Title::isCssJsSubpage
- * and Title::isCssOrJsPage().
+ * because of its dependence on the functionality of Title::isUserConfigPage()
+ * and Title::isSiteConfigPage().
*
* This module supports being used as a placeholder for a module on a remote wiki.
* To do so, getDB() must be overloaded to return a foreign database object that
} elseif ( $new && in_array( $new->getContentFormat(), $formats ) ) {
$purge = true;
} else {
- $purge = ( $title->isCssOrJsPage() || $title->isCssJsSubpage() );
+ $purge = ( $title->isSiteConfigPage() || $title->isUserConfigPage() );
}
if ( $purge ) {
"userjspreview": "<strong>Remember that you are only testing/previewing your user JavaScript.\nIt has not yet been saved!</strong>",
"sitecsspreview": "<strong>Remember that you are only previewing this CSS.\nIt has not yet been saved!</strong>",
"sitejspreview": "<strong>Remember that you are only previewing this JavaScript code.\nIt has not yet been saved!</strong>",
- "userinvalidcssjstitle": "<strong>Warning:</strong> There is no skin \"$1\".\nCustom .css and .js pages use a lowercase title, e.g. {{ns:user}}:Foo/vector.css as opposed to {{ns:user}}:Foo/Vector.css.",
+ "userinvalidconfigtitle": "<strong>Warning:</strong> There is no skin \"$1\".\nCustom .css and .js pages use a lowercase title, e.g. {{ns:user}}:Foo/vector.css as opposed to {{ns:user}}:Foo/Vector.css.",
"updated": "(Updated)",
"note": "<strong>Note:</strong>",
"previewnote": "<strong>Remember that this is only a preview.</strong>\nYour changes have not yet been saved!",
"prefs-files": "Files",
"prefs-custom-css": "Custom CSS",
"prefs-custom-js": "Custom JavaScript",
- "prefs-common-css-js": "Shared CSS/JavaScript for all skins:",
+ "prefs-common-config": "Shared CSS/JavaScript for all skins:",
"prefs-reset-intro": "You can use this page to reset your preferences to the site defaults.\nThis cannot be undone.",
"prefs-emailconfirm-label": "Email confirmation:",
"youremail": "Email:",
"userjspreview": "Text displayed on preview of every user .js subpage",
"sitecsspreview": "Text displayed on preview of .css pages in MediaWiki namespace.\n\nSee also:\n* {{msg-mw|Usercsspreview}}",
"sitejspreview": "Text displayed on preview of .js pages in MediaWiki namespace",
- "userinvalidcssjstitle": "Parameters:\n* $1 - skin name",
+ "userinvalidconfigtitle": "Parameters:\n* $1 - skin name",
"updated": "{{Identical|Updated}}",
"note": "{{Identical|Note}}",
"previewnote": "Note displayed when clicking on Show preview",
"prefs-files": "Title of a tab in [[Special:Preferences]].\n{{Identical|File}}",
"prefs-custom-css": "visible on [[Special:Preferences]] -[Skins].\n{{Identical|Custom CSS}}",
"prefs-custom-js": "visible on [[Special:Preferences]] -[Skins].\n{{Identical|Custom JavaScript}}",
- "prefs-common-css-js": "Used as label in [[Special:Preferences#mw-prefsection-rendering|preferences]], tab \"Appearance\", section \"Skin\".\n\nSee also:\n* {{msg-mw|Globalcssjs-custom-css-js}}",
+ "prefs-common-config": "Used as label in [[Special:Preferences#mw-prefsection-rendering|preferences]], tab \"Appearance\", section \"Skin\".\n\nSee also:\n* {{msg-mw|Globalcssjs-custom-css-js}}",
"prefs-reset-intro": "Used in [[Special:Preferences/reset]].",
"prefs-emailconfirm-label": "Sub-heading in [[Special:Preferences]] > {{int:prefs-personal}} > {{int:email}}.",
"youremail": "Label of the e-mail text box of the \"E-mail options\" section of [[Special:Preferences]].\nAlso used on create account form.\n\n{{Identical|E-mail}}",
$this->assertTrue( $title->hasContentModel( $expectedModelId ) );
}
- public static function provideIsCssOrJsPage() {
+ public static function provideIsSiteConfigPage() {
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.js', false ],
[ 'User:Foo.js', false ],
[ 'User:Foo/bar.js', false ],
[ 'User:Foo/bar.css', false ],
+ [ 'User:Foo/bar.JS', false ],
+ [ 'User:Foo/bar.CSS', false ],
[ 'User talk:Foo/bar.css', false ],
[ 'User:Foo/bar.js.xxx', false ],
[ 'User:Foo/bar.xxx', false ],
[ 'MediaWiki:Foo.css', true ],
[ 'MediaWiki:Foo.JS', false ],
[ 'MediaWiki:Foo.CSS', false ],
+ [ 'MediaWiki:Foo/bar.css', true ],
[ 'MediaWiki:Foo.css.xxx', false ],
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
}
/**
- * @dataProvider provideIsCssOrJsPage
- * @covers Title::isCssOrJsPage
+ * @dataProvider provideIsSiteConfigPage
+ * @covers Title::isSiteConfigPage
*/
- public function testIsCssOrJsPage( $title, $expectedBool ) {
+ public function testSiteConfigPage( $title, $expectedBool ) {
$title = Title::newFromText( $title );
- $this->assertEquals( $expectedBool, $title->isCssOrJsPage() );
+ $this->assertEquals( $expectedBool, $title->isSiteConfigPage() );
}
- public static function provideIsCssJsSubpage() {
+ public static function provideIsUserConfigPage() {
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.js', false ],
[ 'User:Foo', false ],
[ 'User:Foo.js', false ],
[ 'User:Foo/bar.js', true ],
+ [ 'User:Foo/bar.JS', false ],
[ 'User:Foo/bar.css', true ],
+ [ 'User:Foo/bar.CSS', false ],
[ 'User talk:Foo/bar.css', false ],
[ 'User:Foo/bar.js.xxx', false ],
[ 'User:Foo/bar.xxx', false ],
[ 'MediaWiki:Foo.js', false ],
- [ 'User:Foo/bar.JS', false ],
- [ 'User:Foo/bar.CSS', false ],
+ [ 'MediaWiki:Foo.css', false ],
+ [ 'MediaWiki:Foo.JS', false ],
+ [ 'MediaWiki:Foo.CSS', false ],
+ [ 'MediaWiki:Foo.css.xxx', false ],
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
];
}
/**
- * @dataProvider provideIsCssJsSubpage
- * @covers Title::isCssJsSubpage
+ * @dataProvider provideIsUserConfigPage
+ * @covers Title::isUserConfigPage
*/
- public function testIsCssJsSubpage( $title, $expectedBool ) {
+ public function testIsUserConfigPage( $title, $expectedBool ) {
$title = Title::newFromText( $title );
- $this->assertEquals( $expectedBool, $title->isCssJsSubpage() );
+ $this->assertEquals( $expectedBool, $title->isUserConfigPage() );
}
- public static function provideIsCssSubpage() {
+ public static function provideIsUserCssConfigPage() {
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.css', false ],
}
/**
- * @dataProvider provideIsCssSubpage
- * @covers Title::isCssSubpage
+ * @dataProvider provideIsUserCssConfigPage
+ * @covers Title::isUserCssConfigPage
*/
- public function testIsCssSubpage( $title, $expectedBool ) {
+ public function testIsUserCssConfigPage( $title, $expectedBool ) {
$title = Title::newFromText( $title );
- $this->assertEquals( $expectedBool, $title->isCssSubpage() );
+ $this->assertEquals( $expectedBool, $title->isUserCssConfigPage() );
}
- public static function provideIsJsSubpage() {
+ public static function provideIsUserJsConfigPage() {
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.css', false ],
[ 'User:Foo', false ],
[ 'User:Foo.js', false ],
+ [ 'User:Foo.json', false ],
[ 'User:Foo.css', false ],
[ 'User:Foo/bar.js', true ],
+ [ 'User:Foo/bar.json', false ],
[ 'User:Foo/bar.css', false ],
];
}
/**
- * @dataProvider provideIsJsSubpage
- * @covers Title::isJsSubpage
+ * @dataProvider provideIsUserJsConfigPage
+ * @covers Title::isUserJsConfigPage
*/
- public function testIsJsSubpage( $title, $expectedBool ) {
+ public function testIsUserJsConfigPage( $title, $expectedBool ) {
$title = Title::newFromText( $title );
- $this->assertEquals( $expectedBool, $title->isJsSubpage() );
+ $this->assertEquals( $expectedBool, $title->isUserJsConfigPage() );
}
public static function provideIsWikitextPage() {
[ 'User:Foo/bar.js.xxx', true ],
[ 'User:Foo/bar.xxx', true ],
[ 'MediaWiki:Foo.js', false ],
- [ 'MediaWiki:Foo.css', false ],
- [ 'MediaWiki:Foo/bar.css', false ],
[ 'User:Foo/bar.JS', true ],
[ 'User:Foo/bar.CSS', true ],
+ [ 'MediaWiki:Foo.css', false ],
+ [ 'MediaWiki:Foo.JS', true ],
+ [ 'MediaWiki:Foo.CSS', true ],
+ [ 'MediaWiki:Foo.css.xxx', true ],
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
- [ 'TEST-JS_TALK:Foo.js', true ],
];
}
/**
* @todo This test method should be split up into separate test methods and
* data providers
+ * @covers Title::checkQuickPermissions
*/
public function testQuickPermissions() {
global $wgContLang;
/**
* @todo This test method should be split up into separate test methods and
* data providers
+ * @covers Title::checkSpecialsAndNSPermissions
*/
public function testSpecialsAndNSPermissions() {
global $wgNamespaceProtection;
/**
* @todo This test method should be split up into separate test methods and
* data providers
+ * @covers Title::checkUserConfigPermissions
*/
- public function testCssAndJavascriptPermissions() {
+ public function testJsConfigEditPermissions() {
$this->setUser( $this->userName );
$this->setTitle( NS_USER, $this->userName . '/test.js' );
- $this->runCSSandJSPermissions(
+ $this->runConfigEditPermissions(
[ [ 'badaccess-group0' ], [ 'mycustomjsprotected', 'bogus' ] ],
+
[ [ 'badaccess-group0' ], [ 'mycustomjsprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ] ],
+
[ [ 'badaccess-group0' ], [ 'mycustomjsprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ] ]
);
+ }
+
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ * @covers Title::checkUserConfigPermissions
+ */
+ public function testCssConfigEditPermissions() {
+ $this->setUser( $this->userName );
$this->setTitle( NS_USER, $this->userName . '/test.css' );
- $this->runCSSandJSPermissions(
+ $this->runConfigEditPermissions(
[ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ],
+
[ [ 'badaccess-group0' ] ],
[ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ],
+
[ [ 'badaccess-group0' ] ],
[ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ]
);
+ }
+
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ * @covers Title::checkUserConfigPermissions
+ */
+ public function testOtherJsConfigEditPermissions() {
+ $this->setUser( $this->userName );
$this->setTitle( NS_USER, $this->altUserName . '/test.js' );
- $this->runCSSandJSPermissions(
+ $this->runConfigEditPermissions(
[ [ 'badaccess-group0' ], [ 'customjsprotected', 'bogus' ] ],
+
[ [ 'badaccess-group0' ], [ 'customjsprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ], [ 'customjsprotected', 'bogus' ] ],
+
[ [ 'badaccess-group0' ], [ 'customjsprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ] ]
);
+ }
+
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ * @covers Title::checkUserConfigPermissions
+ */
+ public function testOtherCssConfigEditPermissions() {
+ $this->setUser( $this->userName );
$this->setTitle( NS_USER, $this->altUserName . '/test.css' );
- $this->runCSSandJSPermissions(
+ $this->runConfigEditPermissions(
[ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ],
+
[ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ],
+
[ [ 'badaccess-group0' ] ],
[ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ]
);
+ }
+
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ * @covers Title::checkUserConfigPermissions
+ */
+ public function testOtherNonConfigEditPermissions() {
+ $this->setUser( $this->userName );
$this->setTitle( NS_USER, $this->altUserName . '/tempo' );
- $this->runCSSandJSPermissions(
+ $this->runConfigEditPermissions(
[ [ 'badaccess-group0' ] ],
+
[ [ 'badaccess-group0' ] ],
[ [ 'badaccess-group0' ] ],
+
[ [ 'badaccess-group0' ] ],
[ [ 'badaccess-group0' ] ]
);
}
- protected function runCSSandJSPermissions( $result0, $result1, $result2, $result3, $result4 ) {
+ protected function runConfigEditPermissions(
+ $resultNone,
+ $resultMyCss,
+ $resultMyJs,
+ $resultUserCss,
+ $resultUserJs
+ ) {
$this->setUserPerm( '' );
- $this->assertEquals( $result0,
- $this->title->getUserPermissionsErrors( 'bogus',
- $this->user ) );
+ $result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
+ $this->assertEquals( $resultNone, $result );
$this->setUserPerm( 'editmyusercss' );
- $this->assertEquals( $result1,
- $this->title->getUserPermissionsErrors( 'bogus',
- $this->user ) );
+ $result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
+ $this->assertEquals( $resultMyCss, $result );
$this->setUserPerm( 'editmyuserjs' );
- $this->assertEquals( $result2,
- $this->title->getUserPermissionsErrors( 'bogus',
- $this->user ) );
+ $result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
+ $this->assertEquals( $resultMyJs, $result );
$this->setUserPerm( 'editusercss' );
- $this->assertEquals( $result3,
- $this->title->getUserPermissionsErrors( 'bogus',
- $this->user ) );
+ $result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
+ $this->assertEquals( $resultUserCss, $result );
$this->setUserPerm( 'edituserjs' );
- $this->assertEquals( $result4,
- $this->title->getUserPermissionsErrors( 'bogus',
- $this->user ) );
+ $result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
+ $this->assertEquals( $resultUserJs, $result );
$this->setUserPerm( [ 'edituserjs', 'editusercss' ] );
- $this->assertEquals( [ [ 'badaccess-group0' ] ],
- $this->title->getUserPermissionsErrors( 'bogus',
- $this->user ) );
+ $result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
+ $this->assertEquals( [ [ 'badaccess-group0' ] ], $result );
}
/**
* @todo This test method should be split up into separate test methods and
* data providers
+ * @covers Title::checkPageRestrictions
*/
public function testPageRestrictions() {
global $wgContLang;
$this->user ) );
}
+ /**
+ * @covers Title::checkCascadingSourcesRestrictions
+ */
public function testCascadingSourcesRestrictions() {
$this->setTitle( NS_MAIN, "test page" );
$this->setUserPerm( [ "edit", "bogus" ] );
/**
* @todo This test method should be split up into separate test methods and
* data providers
+ * @covers Title::checkActionPermissions
*/
public function testActionPermissions() {
$this->setUserPerm( [ "createpage" ] );
$this->title->userCan( 'move-target', $this->user ) );
}
+ /**
+ * @covers Title::checkUserBlock
+ */
public function testUserBlock() {
global $wgEmailConfirmToEdit, $wgEmailAuthentication;
$wgEmailConfirmToEdit = true;