/**
* @group Database
+ *
+ * @covers Title::getUserPermissionsErrors
+ * @covers Title::getUserPermissionsErrorsInternal
*/
class TitlePermissionTest extends MediaWikiLangTestCase {
date_default_timezone_set( $localZone );
$this->title = Title::makeTitle( NS_MAIN, "Main Page" );
- if ( !isset( $this->userUser ) || !( $this->userUser instanceOf User ) ) {
+ if ( !isset( $this->userUser ) || !( $this->userUser instanceof User ) ) {
$this->userUser = User::newFromName( $this->userName );
if ( !$this->userUser->getID() ) {
}
}
- function setUserPerm( $perm ) {
+ protected function setUserPerm( $perm ) {
// Setting member variables is evil!!!
if ( is_array( $perm ) ) {
}
}
- function setTitle( $ns, $title = "Main_Page" ) {
+ protected function setTitle( $ns, $title = "Main_Page" ) {
$this->title = Title::makeTitle( $ns, $title );
}
- function setUser( $userName = null ) {
+ protected function setUser( $userName = null ) {
if ( $userName === 'anon' ) {
$this->user = $this->anonUser;
} elseif ( $userName === null || $userName === $this->userName ) {
}
}
- function testQuickPermissions() {
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ */
+ public function testQuickPermissions() {
global $wgContLang;
$prefix = $wgContLang->getFormattedNsText( NS_PROJECT );
}
}
- function runGroupPermissions( $action, $result, $result2 = null ) {
+ protected function runGroupPermissions( $action, $result, $result2 = null ) {
global $wgGroupPermissions;
if ( $result2 === null ) {
$this->assertEquals( $result2, $res );
}
- function testSpecialsAndNSPermissions() {
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ */
+ public function testSpecialsAndNSPermissions() {
global $wgNamespaceProtection;
$this->setUser( $this->userName );
$this->title->userCan( 'bogus', $this->user ) );
}
- function testCssAndJavascriptPermissions() {
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ */
+ public function testCssAndJavascriptPermissions() {
$this->setUser( $this->userName );
$this->setTitle( NS_USER, $this->userName . '/test.js' );
);
}
- function runCSSandJSPermissions( $result0, $result1, $result2, $result3, $result4 ) {
+ protected function runCSSandJSPermissions( $result0, $result1, $result2, $result3, $result4 ) {
$this->setUserPerm( '' );
$this->assertEquals( $result0,
$this->title->getUserPermissionsErrors( 'bogus',
$this->user ) );
}
- function testPageRestrictions() {
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ */
+ public function testPageRestrictions() {
global $wgContLang;
$prefix = $wgContLang->getFormattedNsText( NS_PROJECT );
$this->user ) );
}
- function testCascadingSourcesRestrictions() {
+ public function testCascadingSourcesRestrictions() {
$this->setTitle( NS_MAIN, "test page" );
$this->setUserPerm( array( "edit", "bogus" ) );
$this->title->getUserPermissionsErrors( 'edit', $this->user ) );
}
- function testActionPermissions() {
+ /**
+ * @todo This test method should be split up into separate test methods and
+ * data providers
+ */
+ public function testActionPermissions() {
$this->setUserPerm( array( "createpage" ) );
$this->setTitle( NS_MAIN, "test page" );
$this->title->mTitleProtection['pt_create_perm'] = '';
$this->title->userCan( 'move-target', $this->user ) );
}
- function testUserBlock() {
+ public function testUserBlock() {
global $wgEmailConfirmToEdit, $wgEmailAuthentication;
$wgEmailConfirmToEdit = true;
$wgEmailAuthentication = true;