Merge "Revert "Re-enable tests from TitlePermissionTest""
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 9 Oct 2018 01:44:03 +0000 (01:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 9 Oct 2018 01:44:03 +0000 (01:44 +0000)
1  2 
tests/phpunit/includes/TitlePermissionTest.php

@@@ -99,6 -99,10 +99,10 @@@ class TitlePermissionTest extends Media
        /**
         * @todo This test method should be split up into separate test methods and
         * data providers
+        *
+        * This test is failing per T201776.
+        *
+        * @group Broken
         * @covers Title::checkQuickPermissions
         */
        public function testQuickPermissions() {
         * @covers Title::checkUserConfigPermissions
         */
        public function testJsConfigEditPermissions() {
 +              $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
 +                      getFormattedNsText( NS_PROJECT );
                $this->setUser( $this->userName );
  
                $this->setTitle( NS_USER, $this->userName . '/test.js' );
  
                        [ [ 'badaccess-group0' ], [ 'mycustomjsprotected', 'bogus' ] ],
                        [ [ 'badaccess-group0' ], [ 'mycustomjsprotected', 'bogus' ] ],
 -                      [ [ 'badaccess-group0' ] ]
 +                      [ [ 'badaccess-group0' ] ],
 +                      [ [ 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ] ]
                );
        }
  
         * @covers Title::checkUserConfigPermissions
         */
        public function testJsonConfigEditPermissions() {
 +              $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
 +                      getFormattedNsText( NS_PROJECT );
                $this->setUser( $this->userName );
  
                $this->setTitle( NS_USER, $this->userName . '/test.json' );
  
                        [ [ 'badaccess-group0' ], [ 'mycustomjsonprotected', 'bogus' ] ],
                        [ [ 'badaccess-group0' ] ],
 -                      [ [ 'badaccess-group0' ], [ 'mycustomjsonprotected', 'bogus' ] ]
 +                      [ [ 'badaccess-group0' ], [ 'mycustomjsonprotected', 'bogus' ] ],
 +                      [ [ 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ] ]
                );
        }
  
         * @covers Title::checkUserConfigPermissions
         */
        public function testCssConfigEditPermissions() {
 +              $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
 +                      getFormattedNsText( NS_PROJECT );
                $this->setUser( $this->userName );
  
                $this->setTitle( NS_USER, $this->userName . '/test.css' );
  
                        [ [ 'badaccess-group0' ] ],
                        [ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ],
 -                      [ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ]
 +                      [ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ],
 +                      [ [ 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ] ]
                );
        }
  
         * @covers Title::checkUserConfigPermissions
         */
        public function testOtherJsConfigEditPermissions() {
 +              $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
 +                      getFormattedNsText( NS_PROJECT );
                $this->setUser( $this->userName );
  
                $this->setTitle( NS_USER, $this->altUserName . '/test.js' );
  
                        [ [ 'badaccess-group0' ], [ 'customjsprotected', 'bogus' ] ],
                        [ [ 'badaccess-group0' ], [ 'customjsprotected', 'bogus' ] ],
 -                      [ [ 'badaccess-group0' ] ]
 +                      [ [ 'badaccess-group0' ] ],
 +                      [ [ 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ] ]
                );
        }
  
         * @covers Title::checkUserConfigPermissions
         */
        public function testOtherJsonConfigEditPermissions() {
 +              $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
 +                      getFormattedNsText( NS_PROJECT );
                $this->setUser( $this->userName );
  
                $this->setTitle( NS_USER, $this->altUserName . '/test.json' );
  
                        [ [ 'badaccess-group0' ], [ 'customjsonprotected', 'bogus' ] ],
                        [ [ 'badaccess-group0' ] ],
 -                      [ [ 'badaccess-group0' ], [ 'customjsonprotected', 'bogus' ] ]
 +                      [ [ 'badaccess-group0' ], [ 'customjsonprotected', 'bogus' ] ],
 +                      [ [ 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ] ]
                );
        }
  
         * @covers Title::checkUserConfigPermissions
         */
        public function testOtherCssConfigEditPermissions() {
 +              $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
 +                      getFormattedNsText( NS_PROJECT );
                $this->setUser( $this->userName );
  
                $this->setTitle( NS_USER, $this->altUserName . '/test.css' );
  
                        [ [ 'badaccess-group0' ] ],
                        [ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ],
 -                      [ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ]
 +                      [ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ],
 +                      [ [ 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ] ]
                );
        }
  
         * @covers Title::checkUserConfigPermissions
         */
        public function testOtherNonConfigEditPermissions() {
 +              $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
 +                      getFormattedNsText( NS_PROJECT );
                $this->setUser( $this->userName );
  
                $this->setTitle( NS_USER, $this->altUserName . '/tempo' );
  
                        [ [ 'badaccess-group0' ] ],
                        [ [ 'badaccess-group0' ] ],
 -                      [ [ 'badaccess-group0' ] ]
 +                      [ [ 'badaccess-group0' ] ],
 +                      [ [ 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ] ]
 +              );
 +      }
 +
 +      /**
 +       * @todo This should use data providers like the other methods here.
 +       * @covers Title::checkUserConfigPermissions
 +       */
 +      public function testPatrolActionConfigEditPermissions() {
 +              $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
 +                      getFormattedNsText( NS_PROJECT );
 +              $this->setUser( 'anon' );
 +              $this->setTitle( NS_USER, 'ToPatrolOrNotToPatrol' );
 +              $this->runConfigEditPermissions(
 +                      [ [ 'badaccess-group0' ] ],
 +
 +                      [ [ 'badaccess-group0' ] ],
 +                      [ [ 'badaccess-group0' ] ],
 +                      [ [ 'badaccess-group0' ] ],
 +
 +                      [ [ 'badaccess-group0' ] ],
 +                      [ [ 'badaccess-group0' ] ],
 +                      [ [ 'badaccess-group0' ] ],
 +                      [ [ 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ] ]
                );
        }
  
                $resultMyJs,
                $resultUserCss,
                $resultUserJson,
 -              $resultUserJs
 +              $resultUserJs,
 +              $resultPatrol
        ) {
                $this->setUserPerm( '' );
                $result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
                $result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
                $this->assertEquals( $resultUserJs, $result );
  
 +              $this->setUserPerm( '' );
 +              $result = $this->title->getUserPermissionsErrors( 'patrol', $this->user );
 +              $this->assertEquals( $resultPatrol, $result );
 +
                $this->setUserPerm( [ 'edituserjs', 'edituserjson', 'editusercss' ] );
                $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
+        *
+        * This test is failing per T201776.
+        *
+        * @group Broken
         * @covers Title::checkPageRestrictions
         */
        public function testPageRestrictions() {