The name change happened some time ago, and I think its about time to start using the name name! (Done with a find and replace) My personal motivation for doing this is that I have started trying out vscode as an IDE for mediawiki development, and right now it doesn't appear to handle php aliases very well or at all. Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
class PasswordPolicyStructureTest extends MediaWikiIntegrationTestCase {
|
|
|
|
public function provideChecks() {
|
|
global $wgPasswordPolicy;
|
|
|
|
foreach ( $wgPasswordPolicy['checks'] as $name => $callback ) {
|
|
yield [ $name ];
|
|
}
|
|
}
|
|
|
|
public function provideFlags() {
|
|
global $wgPasswordPolicy;
|
|
|
|
// This won't actually find all flags, just the ones in use. Can't really be helped,
|
|
// other than adding the core flags here.
|
|
$flags = [ 'forceChange', 'suggestChangeOnLogin' ];
|
|
foreach ( $wgPasswordPolicy['policies'] as $group => $checks ) {
|
|
foreach ( $checks as $check => $settings ) {
|
|
if ( is_array( $settings ) ) {
|
|
$flags = array_unique(
|
|
array_merge( $flags, array_diff( array_keys( $settings ), [ 'value' ] ) )
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ( $flags as $flag ) {
|
|
yield [ $flag ];
|
|
}
|
|
}
|
|
|
|
/** @dataProvider provideChecks */
|
|
public function testCheckMessage( $check ) {
|
|
$msg = wfMessage( 'passwordpolicies-policy-' . strtolower( $check ) );
|
|
$this->assertTrue( $msg->exists() );
|
|
}
|
|
|
|
/** @dataProvider provideFlags */
|
|
public function testFlagMessage( $flag ) {
|
|
$msg = wfMessage( 'passwordpolicies-policyflag-' . strtolower( $flag ) );
|
|
$this->assertTrue( $msg->exists() );
|
|
}
|
|
|
|
}
|