Make deprecated TestUser properties private
authoraddshore <addshorewiki@gmail.com>
Fri, 6 May 2016 15:11:08 +0000 (16:11 +0100)
committerAddshore <addshorewiki@gmail.com>
Wed, 22 Jun 2016 15:43:54 +0000 (15:43 +0000)
Change-Id: I18d6299bad773d16c04b6ea79331c81af8f538bc
Depends-On: I5317616f99f1344557fd818d0b00073a82197d05
Depends-On: I15be3de63b2ce13e0ea07b235efd7756c97cebfc
Depends-On: I80a50e50493ad04f20cab3a1e094a5c3ecb1c19f

tests/phpunit/includes/TestUser.php
tests/phpunit/includes/api/ApiTestCase.php
tests/phpunit/includes/api/ApiTokensTest.php
tests/phpunit/includes/upload/UploadStashTest.php

index 8b8cbcd..86f4ae7 100644 (file)
@@ -6,25 +6,19 @@
  */
 class TestUser {
        /**
-        * @deprecated Since 1.25. Use TestUser::getUser()->getName()
-        * @private
         * @var string
         */
-       public $username;
+       private $username;
 
        /**
-        * @deprecated Since 1.25. Use TestUser::getPassword()
-        * @private
         * @var string
         */
-       public $password;
+       private $password;
 
        /**
-        * @deprecated Since 1.25. Use TestUser::getUser()
-        * @private
         * @var User
         */
-       public $user;
+       private $user;
 
        private function assertNotReal() {
                global $wgDBprefix;
index 31f3daa..ac4d2c9 100644 (file)
@@ -24,7 +24,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
                $this->setMwGlobals( [
                        'wgAuth' => $wgDisableAuthManager ? new AuthPlugin : new MediaWiki\Auth\AuthManagerAuthPlugin,
                        'wgRequest' => new FauxRequest( [] ),
-                       'wgUser' => self::$users['sysop']->user,
+                       'wgUser' => self::$users['sysop']->getUser(),
                ] );
 
                $this->apiContext = new ApiTestContext();
@@ -183,11 +183,11 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
                return $data;
        }
 
-       protected function getTokenList( $user, $session = null ) {
+       protected function getTokenList( TestUser $user, $session = null ) {
                $data = $this->doApiRequest( [
                        'action' => 'tokens',
                        'type' => 'edit|delete|protect|move|block|unblock|watch'
-               ], $session, false, $user->user );
+               ], $session, false, $user->getUser() );
 
                if ( !array_key_exists( 'tokens', $data[0] ) ) {
                        throw new MWException( 'Api failed to return a token list' );
index fbe9789..1f7c00b 100644 (file)
@@ -15,10 +15,10 @@ class ApiTokensTest extends ApiTestCase {
                }
        }
 
-       protected function runTokenTest( $user ) {
+       protected function runTokenTest( TestUser $user ) {
                $tokens = $this->getTokenList( $user );
 
-               $rights = $user->user->getRights();
+               $rights = $user->getUser()->getRights();
 
                $this->assertArrayHasKey( 'edittoken', $tokens );
                $this->assertArrayHasKey( 'movetoken', $tokens );
index e0b57a7..9b25505 100644 (file)
@@ -7,7 +7,7 @@
  */
 class UploadStashTest extends MediaWikiTestCase {
        /**
-        * @var array Array of UploadStashTestUser
+        * @var TestUser[] Array of UploadStashTestUser
         */
        public static $users;
 
@@ -55,7 +55,7 @@ class UploadStashTest extends MediaWikiTestCase {
         * @todo give this test a real name explaining what is being tested here
         */
        public function testBug29408() {
-               $this->setMwGlobals( 'wgUser', self::$users['uploader']->user );
+               $this->setMwGlobals( 'wgUser', self::$users['uploader']->getUser() );
 
                $repo = RepoGroup::singleton()->getLocalRepo();
                $stash = new UploadStash( $repo );