Page MenuHomeWickedGov Phorge

PasswordPolicyStructureTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

PasswordPolicyStructureTest.php

<?php
/**
* @coversNothing
*/
class PasswordPolicyStructureTest extends MediaWikiIntegrationTestCase {
public static function provideChecks() {
global $wgPasswordPolicy;
foreach ( $wgPasswordPolicy['checks'] as $name => $callback ) {
yield [ $name ];
}
}
public static 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() );
}
}

File Metadata

Mime Type
text/x-php
Expires
Aug 18 2026, 12:30 (4 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
de/9d/b543f7f68e0be829db68e6ce87e2
Default Alt Text
PasswordPolicyStructureTest.php (1 KB)

Event Timeline