X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fuser%2FPasswordResetTest.php;h=1f578ab0c877a01fbe0a0cf5f779b26702027aef;hb=a3cd158d8433e41cbeb299f0e268dfef363b2afd;hp=68b79591f643a9bd12ecbe09c8378418298394e0;hpb=9ac5caffb48b32d2ba4b9be03a5682d657186c7f;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/user/PasswordResetTest.php b/tests/phpunit/includes/user/PasswordResetTest.php index 68b79591f6..ca57c10b6f 100644 --- a/tests/phpunit/includes/user/PasswordResetTest.php +++ b/tests/phpunit/includes/user/PasswordResetTest.php @@ -1,8 +1,10 @@ true, 'allowsAuthenticationDataChange' => true, 'canEditPrivate' => true, - 'block' => new Block( [ 'systemBlock' => 'proxy' ] ), + 'block' => new SystemBlock( + [ 'systemBlock' => 'proxy' ] + ), 'globalBlock' => null, 'isAllowed' => false, ], - 'globally blocked with account creation disabled' => [ + 'globally blocked with account creation not disabled' => [ 'passwordResetRoutes' => [ 'username' => true ], 'enableEmail' => true, 'allowsAuthenticationDataChange' => true, 'canEditPrivate' => true, 'block' => null, - 'globalBlock' => new Block( [ 'systemBlock' => 'global-block', 'createAccount' => true ] ), - 'isAllowed' => false, + 'globalBlock' => new SystemBlock( + [ 'systemBlock' => 'global-block' ] + ), + 'isAllowed' => true, ], - 'globally blocked with account creation not disabled' => [ + 'blocked via wgSoftBlockRanges' => [ 'passwordResetRoutes' => [ 'username' => true ], 'enableEmail' => true, 'allowsAuthenticationDataChange' => true, 'canEditPrivate' => true, - 'block' => null, - 'globalBlock' => new Block( [ 'systemBlock' => 'global-block', 'createAccount' => false ] ), + 'block' => new SystemBlock( + [ 'systemBlock' => 'wgSoftBlockRanges', 'anonOnly' => true ] + ), + 'globalBlock' => null, 'isAllowed' => true, ], - 'blocked via wgSoftBlockRanges' => [ + 'blocked with an unknown system block type' => [ 'passwordResetRoutes' => [ 'username' => true ], 'enableEmail' => true, 'allowsAuthenticationDataChange' => true, 'canEditPrivate' => true, - 'block' => new Block( [ 'systemBlock' => 'wgSoftBlockRanges', 'anonOnly' => true ] ), + 'block' => new SystemBlock( [ 'systemBlock' => 'unknown' ] ), 'globalBlock' => null, - 'isAllowed' => true, + 'isAllowed' => false, ], 'all OK' => [ 'passwordResetRoutes' => [ 'username' => true ], @@ -167,6 +175,7 @@ class PasswordResetTest extends MediaWikiTestCase { $performingUser = $this->getMockBuilder( User::class )->getMock(); $performingUser->expects( $this->any() )->method( 'getRequest' )->willReturn( $request ); $performingUser->expects( $this->any() )->method( 'isAllowed' )->willReturn( true ); + $performingUser->expects( $this->any() )->method( 'getName' )->willReturn( 'Performer' ); $targetUser1 = $this->getMockBuilder( User::class )->getMock(); $targetUser2 = $this->getMockBuilder( User::class )->getMock();