X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fuser%2FPasswordResetTest.php;h=ca57c10b6f5ae9e2b2555adabbfe0d0a2bd5cad4;hp=1f578ab0c877a01fbe0a0cf5f779b26702027aef;hb=a3cd158d8433e41cbeb299f0e268dfef363b2afd;hpb=fe4b09380562976aea9f06e59d342fff8d91b026 diff --git a/tests/phpunit/includes/user/PasswordResetTest.php b/tests/phpunit/includes/user/PasswordResetTest.php index 1f578ab0c8..ca57c10b6f 100644 --- a/tests/phpunit/includes/user/PasswordResetTest.php +++ b/tests/phpunit/includes/user/PasswordResetTest.php @@ -1,6 +1,7 @@ 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 ], @@ -168,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();