Merge "Make ExternalStoreDB "wiki" context override the server "dbname" field"
[lhc/web/wiklou.git] / tests / phpunit / includes / password / PasswordPolicyChecksTest.php
index 7dfb3cf..2d20f2c 100644 (file)
@@ -150,10 +150,27 @@ class PasswordPolicyChecksTest extends MediaWikiTestCase {
                global $IP;
                $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() );
        }
+
+       /**
+        * Verify that all password policy description messages actually exist.
+        * Messages used on Special:PasswordPolicies
+        */
+       public function testPasswordPolicyDescriptionsExist() {
+               global $wgPasswordPolicy;
+               $lang = Language::factory( 'en' );
+
+               foreach ( array_keys( $wgPasswordPolicy['checks'] ) as $check ) {
+                       $msgKey = 'passwordpolicies-policy-' . strtolower( $check );
+                       $this->assertTrue(
+                               wfMessage( $msgKey )->useDatabase( false )->inLanguage( $lang )->exists(),
+                               "Message '$msgKey' required by '$check' must exist"
+                       );
+               }
+       }
 }