/**
* @group Database
- * @todo covers tags
+ *
+ * @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() ) {
$this->runGroupPermissions( 'move', array( array( 'movenotallowedfile' ) ) );
$this->setUserPerm( "" );
- $this->runGroupPermissions( 'move', array( array( 'movenotallowedfile' ), array( 'movenotallowed' ) ) );
+ $this->runGroupPermissions(
+ 'move',
+ array( array( 'movenotallowedfile' ), array( 'movenotallowed' ) )
+ );
$this->setUser( 'anon' );
$this->setUserPerm( "move" );
$this->runGroupPermissions( 'move', array( array( 'movenotallowedfile' ) ) );
$this->setUserPerm( "" );
- $this->runGroupPermissions( 'move', array( array( 'movenotallowedfile' ), array( 'movenotallowed' ) ),
- array( array( 'movenotallowedfile' ), array( 'movenologintext' ) ) );
+ $this->runGroupPermissions(
+ 'move',
+ array( array( 'movenotallowedfile' ), array( 'movenotallowed' ) ),
+ array( array( 'movenotallowedfile' ), array( 'movenologintext' ) )
+ );
if ( $this->isWikitextNS( NS_MAIN ) ) {
//NOTE: some content models don't allow moving
$this->assertEquals( array(), $res );
$this->setUser( 'anon' );
- $check = array( 'edit' => array( array( array( 'badaccess-groups', "*, [[$prefix:Users|Users]]", 2 ) ),
- array( array( 'badaccess-group0' ) ),
- array(), true ),
- 'protect' => array( array( array( 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ), array( 'protect-cantedit' ) ),
+ $check = array(
+ 'edit' => array(
+ array( array( 'badaccess-groups', "*, [[$prefix:Users|Users]]", 2 ) ),
+ array( array( 'badaccess-group0' ) ),
+ array(),
+ true
+ ),
+ 'protect' => array(
+ array( array(
+ 'badaccess-groups',
+ "[[$prefix:Administrators|Administrators]]", 1 ),
+ array( 'protect-cantedit'
+ ) ),
array( array( 'badaccess-group0' ), array( 'protect-cantedit' ) ),
- array( array( 'protect-cantedit' ) ), false ),
- '' => array( array(), array(), array(), true ) );
+ array( array( 'protect-cantedit' ) ),
+ false
+ ),
+ '' => array( array(), array(), array(), true )
+ );
foreach ( array( "edit", "protect", "" ) as $action ) {
$this->setUserPerm( null );
$this->setTitle( NS_MAIN, "test page" );
$this->setUserPerm( array( "edit", "bogus" ) );
- $this->title->mCascadeSources = array( Title::makeTitle( NS_MAIN, "Bogus" ), Title::makeTitle( NS_MAIN, "UnBogus" ) );
- $this->title->mCascadingRestrictions = array( "bogus" => array( 'bogus', "sysop", "protect", "" ) );
+ $this->title->mCascadeSources = array(
+ Title::makeTitle( NS_MAIN, "Bogus" ),
+ Title::makeTitle( NS_MAIN, "UnBogus" )
+ );
+ $this->title->mCascadingRestrictions = array(
+ "bogus" => array( 'bogus', "sysop", "protect", "" )
+ );
$this->assertEquals( false,
$this->title->userCan( 'bogus', $this->user ) );