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=5ddbe271ebb1c13af2c077ed979e16632cbecce4;hb=0d3807c510762187f6364f22a3d1c78fab8f51d8;hpb=97402532d48de203925a850a4afa2d8f43e3dd9f diff --git a/tests/phpunit/includes/password/PasswordPolicyChecksTest.php b/tests/phpunit/includes/password/PasswordPolicyChecksTest.php index 5ddbe271eb..9f9824f8b7 100644 --- a/tests/phpunit/includes/password/PasswordPolicyChecksTest.php +++ b/tests/phpunit/includes/password/PasswordPolicyChecksTest.php @@ -148,15 +148,36 @@ class PasswordPolicyChecksTest extends MediaWikiTestCase { */ public function testCheckPopularPasswordBlacklist( $expected, $password ) { global $IP; + $this->hideDeprecated( 'PasswordPolicyChecks::checkPopularPasswordBlacklist' ); $this->setMwGlobals( [ 'wgSitename' => 'sitename', - 'wgPopularPasswordFile' => "$IP/serialized/commonpasswords.cdb" + 'wgPopularPasswordFile' => "$IP/includes/password/commonpasswords.cdb" ] ); $user = User::newFromName( 'username' ); $status = PasswordPolicyChecks::checkPopularPasswordBlacklist( PHP_INT_MAX, $user, $password ); $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