Merge "Set default for Block::appliesToPasswordReset to true"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 2 Apr 2019 14:15:23 +0000 (14:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 2 Apr 2019 14:15:23 +0000 (14:15 +0000)
includes/Block.php
tests/phpunit/includes/user/PasswordResetTest.php

index 58ef448..c6b9482 100644 (file)
@@ -2146,7 +2146,7 @@ class Block {
         * Check if the block prevents a user from resetting their password
         *
         * @since 1.33
-        * @return bool|null The block blocks password reset
+        * @return bool The block blocks password reset
         */
        public function appliesToPasswordReset() {
                switch ( $this->getSystemBlockType() ) {
@@ -2159,7 +2159,7 @@ class Block {
                        case 'wgSoftBlockRanges':
                                return false;
                        default:
-                               return false;
+                               return true;
                }
        }
 
index 4978b72..e8334d6 100644 (file)
@@ -133,6 +133,15 @@ class PasswordResetTest extends MediaWikiTestCase {
                                'globalBlock' => null,
                                'isAllowed' => true,
                        ],
+                       'blocked with an unknown system block type' => [
+                               'passwordResetRoutes' => [ 'username' => true ],
+                               'enableEmail' => true,
+                               'allowsAuthenticationDataChange' => true,
+                               'canEditPrivate' => true,
+                               'block' => new Block( [ 'systemBlock' => 'unknown' ] ),
+                               'globalBlock' => null,
+                               'isAllowed' => false,
+                       ],
                        'all OK' => [
                                'passwordResetRoutes' => [ 'username' => true ],
                                'enableEmail' => true,