Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / structure / PasswordPolicyStructureTest.php
blob7dfc11c0f7b4b368cc5c15c917e2f57369244cb6
1 <?php
3 /**
4 * @coversNothing
5 */
6 class PasswordPolicyStructureTest extends MediaWikiIntegrationTestCase {
8 public static function provideChecks() {
9 global $wgPasswordPolicy;
11 foreach ( $wgPasswordPolicy['checks'] as $name => $callback ) {
12 yield [ $name ];
16 public static function provideFlags() {
17 global $wgPasswordPolicy;
19 // This won't actually find all flags, just the ones in use. Can't really be helped,
20 // other than adding the core flags here.
21 $flags = [ 'forceChange', 'suggestChangeOnLogin' ];
22 foreach ( $wgPasswordPolicy['policies'] as $group => $checks ) {
23 foreach ( $checks as $check => $settings ) {
24 if ( is_array( $settings ) ) {
25 $flags = array_unique(
26 array_merge( $flags, array_diff( array_keys( $settings ), [ 'value' ] ) )
32 foreach ( $flags as $flag ) {
33 yield [ $flag ];
37 /** @dataProvider provideChecks */
38 public function testCheckMessage( $check ) {
39 $msg = wfMessage( 'passwordpolicies-policy-' . strtolower( $check ) );
40 $this->assertTrue( $msg->exists() );
43 /** @dataProvider provideFlags */
44 public function testFlagMessage( $flag ) {
45 $msg = wfMessage( 'passwordpolicies-policyflag-' . strtolower( $flag ) );
46 $this->assertTrue( $msg->exists() );