X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fpassword%2FPasswordPolicyChecksTest.php;h=9f9824f8b73fff489f5fba427dc34e0e049e7927;hp=2d20f2c0ce8ddd05bbcf08007e4d6b441f5dc0e4;hb=0d3807c510762187f6364f22a3d1c78fab8f51d8;hpb=b6e8f22e2f293a949d064bb3dce662942bc81ad0 diff --git a/tests/phpunit/includes/password/PasswordPolicyChecksTest.php b/tests/phpunit/includes/password/PasswordPolicyChecksTest.php index 2d20f2c0ce..9f9824f8b7 100644 --- a/tests/phpunit/includes/password/PasswordPolicyChecksTest.php +++ b/tests/phpunit/includes/password/PasswordPolicyChecksTest.php @@ -148,6 +148,7 @@ class PasswordPolicyChecksTest extends MediaWikiTestCase { */ public function testCheckPopularPasswordBlacklist( $expected, $password ) { global $IP; + $this->hideDeprecated( 'PasswordPolicyChecks::checkPopularPasswordBlacklist' ); $this->setMwGlobals( [ 'wgSitename' => 'sitename', 'wgPopularPasswordFile' => "$IP/includes/password/commonpasswords.cdb" @@ -157,6 +158,26 @@ class PasswordPolicyChecksTest extends MediaWikiTestCase { $this->assertSame( $expected, $status->isGood() ); } + public static function provideLargeBlacklist() { + return [ + [ false, 'testpass' ], + [ false, 'password' ], + [ false, '12345' ], + [ true, 'DKn17egcA4' ], + [ true, 'testwikijenkinspass' ], + ]; + } + + /** + * @covers PasswordPolicyChecks::checkPasswordNotInLargeBlacklist + * @dataProvider provideLargeBlacklist + */ + public function testCheckNotInLargeBlacklist( $expected, $password ) { + $user = User::newFromName( 'username' ); + $status = PasswordPolicyChecks::checkPasswordNotInLargeBlacklist( true, $user, $password ); + $this->assertSame( $expected, $status->isGood() ); + } + /** * Verify that all password policy description messages actually exist. * Messages used on Special:PasswordPolicies