More documentation!
[lhc/web/wiklou.git] / tests / phpunit / includes / TitlePermissionTest.php
index 753709c..a91c161 100644 (file)
@@ -5,12 +5,16 @@
  */
 class TitlePermissionTest extends MediaWikiLangTestCase {
        protected $title;
-       protected $user;
-       protected $anonUser;
-       protected $userUser;
-       protected $altUser;
-       protected $userName;
-       protected $altUserName;
+
+       /**
+        * @var User
+        */
+       protected $user, $anonUser, $userUser, $altUser;
+
+       /**
+        * @var string
+        */
+       protected $userName, $altUserName;
 
        function setUp() {
                global $wgLocaltimezone, $wgLocalTZoffset, $wgMemc, $wgContLang, $wgLang;
@@ -56,11 +60,17 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
        }
 
        function setUserPerm( $perm ) {
-               if ( is_array( $perm ) ) {
-                       $this->user->mRights = $perm;
-               } else {
-                       $this->user->mRights = array( $perm );
+               // Setting member variables is evil!!!
+
+               if ( !is_array( $perm ) ) {
+                       $perm = array( $perm );
+               }
+               for ($i = 0; $i < 100; $i++) {
+                       $this->user->mRights[$i] = $perm;
                }
+
+               // Hack, hack hack ...
+               $this->user->mRights['*'] = $perm;
        }
 
        function setTitle( $ns, $title = "Main_Page" ) {
@@ -384,7 +394,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                                                         $this->title->userCan( 'bogus' ) );
        }
 
-       function testCSSandJSPermissions() {
+       function testCssAndJavascriptPermissions() {
                $this->setUser( $this->userName );
                global $wgUser;
                $wgUser = $this->user;
@@ -537,7 +547,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                $this->setTitle( NS_MAIN, "test page" );
                $this->title->mTitleProtection['pt_create_perm'] = '';
                $this->title->mTitleProtection['pt_user'] = $this->user->getID();
-               $this->title->mTitleProtection['pt_expiry'] = Block::infinity();
+               $this->title->mTitleProtection['pt_expiry'] = wfGetDB( DB_SLAVE )->getInfinity();
                $this->title->mTitleProtection['pt_reason'] = 'test';
                $this->title->mCascadeRestriction = false;
 
@@ -574,7 +584,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                                                         $this->title->userCan( 'move' ) );
 
                $this->title->mInterwiki = "no";
-               $this->assertEquals( array( array( 'immobile-page' ) ),
+               $this->assertEquals( array( array( 'immobile-source-page' ) ),
                                                         $this->title->getUserPermissionsErrors( 'move', $this->user ) );
                $this->assertEquals( false,
                                                         $this->title->userCan( 'move' ) );