MediaWiki REL1_28
PasswordPolicyChecksTest.php
Go to the documentation of this file.
1<?php
24
30 3, // policy value
31 User::newFromName( 'user' ), // User
32 'password' // password
33 );
34 $this->assertTrue( $statusOK->isGood(), 'Password is longer than minimal policy' );
36 10, // policy value
37 User::newFromName( 'user' ), // User
38 'password' // password
39 );
40 $this->assertFalse(
41 $statusShort->isGood(),
42 'Password is shorter than minimal policy'
43 );
44 $this->assertTrue(
45 $statusShort->isOK(),
46 'Password is shorter than minimal policy, not fatal'
47 );
48 }
49
55 3, // policy value
56 User::newFromName( 'user' ), // User
57 'password' // password
58 );
59 $this->assertTrue( $statusOK->isGood(), 'Password is longer than minimal policy' );
61 10, // policy value
62 User::newFromName( 'user' ), // User
63 'password' // password
64 );
65 $this->assertFalse(
66 $statusShort->isGood(),
67 'Password is shorter than minimum login policy'
68 );
69 $this->assertFalse(
70 $statusShort->isOK(),
71 'Password is shorter than minimum login policy, fatal'
72 );
73 }
74
80 100, // policy value
81 User::newFromName( 'user' ), // User
82 'password' // password
83 );
84 $this->assertTrue( $statusOK->isGood(), 'Password is shorter than maximal policy' );
86 4, // policy value
87 User::newFromName( 'user' ), // User
88 'password' // password
89 );
90 $this->assertFalse( $statusLong->isGood(),
91 'Password is longer than maximal policy'
92 );
93 $this->assertFalse( $statusLong->isOK(),
94 'Password is longer than maximal policy, fatal'
95 );
96 }
97
103 1, // policy value
104 User::newFromName( 'user' ), // User
105 'password' // password
106 );
107 $this->assertTrue( $statusOK->isGood(), 'Password does not match username' );
109 1, // policy value
110 User::newFromName( 'user' ), // User
111 'user' // password
112 );
113 $this->assertFalse( $statusLong->isGood(), 'Password matches username' );
114 $this->assertTrue( $statusLong->isOK(), 'Password matches username, not fatal' );
115 }
116
122 true, // policy value
123 User::newFromName( 'Username' ), // User
124 'AUniquePassword' // password
125 );
126 $this->assertTrue( $statusOK->isGood(), 'Password is not on blacklist' );
128 true, // policy value
129 User::newFromName( 'Useruser1' ), // User
130 'Passpass1' // password
131 );
132 $this->assertFalse( $statusLong->isGood(), 'Password matches blacklist' );
133 $this->assertTrue( $statusLong->isOK(), 'Password matches blacklist, not fatal' );
134 }
135
136}
testCheckPasswordCannotMatchUsername()
PasswordPolicyChecks::checkPasswordCannotMatchUsername.
testCheckMinimumPasswordLengthToLogin()
PasswordPolicyChecks::checkMinimumPasswordLengthToLogin.
testCheckMaximalPasswordLength()
PasswordPolicyChecks::checkMaximalPasswordLength.
testCheckPasswordCannotMatchBlacklist()
PasswordPolicyChecks::checkPasswordCannotMatchBlacklist.
testCheckMinimalPasswordLength()
PasswordPolicyChecks::checkMinimalPasswordLength.
static checkPasswordCannotMatchUsername( $policyVal, User $user, $password)
Check if username and password match.
static checkMinimalPasswordLength( $policyVal, User $user, $password)
Check password is longer than minimum, not fatal.
static checkPasswordCannotMatchBlacklist( $policyVal, User $user, $password)
Check if username and password are on a blacklist.
static checkMinimumPasswordLengthToLogin( $policyVal, User $user, $password)
Check password is longer than minimum, fatal.
static checkMaximalPasswordLength( $policyVal, User $user, $password)
Check password is shorter than maximum, fatal.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37