@@ -64,8 +64,8 @@ public function testMatchPasswordMinimumChars()
6464 PasswordDefinition::ALLOW_SEQUENTIAL => 1 , // Allow sequential characters
6565 PasswordDefinition::ALLOW_REPEATED => 1 // Allow repeated characters
6666 ]);
67- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('1234567 ' ));
68- $ this ->assertTrue ( $ passwordDefinition ->matchPassword ('12345678 ' ));
67+ $ this ->assertEquals (PasswordDefinition:: FAIL_MINIMUM_CHARS , $ passwordDefinition ->matchPassword ('1234567 ' ));
68+ $ this ->assertEquals (PasswordDefinition:: SUCCESS , $ passwordDefinition ->matchPassword ('12345678 ' ));
6969 }
7070
7171 public function testMatchPasswordUppercase ()
@@ -80,9 +80,9 @@ public function testMatchPasswordUppercase()
8080 PasswordDefinition::ALLOW_SEQUENTIAL => 1 , // Allow sequential characters
8181 PasswordDefinition::ALLOW_REPEATED => 1 // Allow repeated characters
8282 ]);
83- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('12345678 ' ));
84- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('12345678A ' ));
85- $ this ->assertTrue ( $ passwordDefinition ->matchPassword ('1234567BA ' ));
83+ $ this ->assertEquals (PasswordDefinition:: FAIL_UPPERCASE , $ passwordDefinition ->matchPassword ('12345678 ' ));
84+ $ this ->assertEquals (PasswordDefinition:: FAIL_UPPERCASE , $ passwordDefinition ->matchPassword ('12345678A ' ));
85+ $ this ->assertEquals (PasswordDefinition:: SUCCESS , $ passwordDefinition ->matchPassword ('1234567BA ' ));
8686 }
8787
8888 public function testMatchPasswordLowercase ()
@@ -97,9 +97,9 @@ public function testMatchPasswordLowercase()
9797 PasswordDefinition::ALLOW_SEQUENTIAL => 1 , // Allow sequential characters
9898 PasswordDefinition::ALLOW_REPEATED => 1 // Allow repeated characters
9999 ]);
100- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('12345678 ' ));
101- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('12345678a ' ));
102- $ this ->assertTrue ( $ passwordDefinition ->matchPassword ('1234567ba ' ));
100+ $ this ->assertEquals (PasswordDefinition:: FAIL_LOWERCASE , $ passwordDefinition ->matchPassword ('12345678 ' ));
101+ $ this ->assertEquals (PasswordDefinition:: FAIL_LOWERCASE , $ passwordDefinition ->matchPassword ('12345678a ' ));
102+ $ this ->assertEquals (PasswordDefinition:: SUCCESS , $ passwordDefinition ->matchPassword ('1234567ba ' ));
103103 }
104104
105105 public function testMatchPasswordSymbols ()
@@ -114,9 +114,9 @@ public function testMatchPasswordSymbols()
114114 PasswordDefinition::ALLOW_SEQUENTIAL => 1 , // Allow sequential characters
115115 PasswordDefinition::ALLOW_REPEATED => 1 // Allow repeated characters
116116 ]);
117- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('12345678 ' ));
118- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('12345678! ' ));
119- $ this ->assertTrue ( $ passwordDefinition ->matchPassword ('1234567!! ' ));
117+ $ this ->assertEquals (PasswordDefinition:: FAIL_SYMBOLS , $ passwordDefinition ->matchPassword ('12345678 ' ));
118+ $ this ->assertEquals (PasswordDefinition:: FAIL_SYMBOLS , $ passwordDefinition ->matchPassword ('12345678! ' ));
119+ $ this ->assertEquals (PasswordDefinition:: SUCCESS , $ passwordDefinition ->matchPassword ('1234567!! ' ));
120120 }
121121
122122 public function testMatchPasswordNumbers ()
@@ -131,9 +131,9 @@ public function testMatchPasswordNumbers()
131131 PasswordDefinition::ALLOW_SEQUENTIAL => 1 , // Allow sequential characters
132132 PasswordDefinition::ALLOW_REPEATED => 1 // Allow repeated characters
133133 ]);
134- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('abcdefgh ' ));
135- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('abcdefg1 ' ));
136- $ this ->assertTrue ( $ passwordDefinition ->matchPassword ('abcdef11 ' ));
134+ $ this ->assertEquals (PasswordDefinition:: FAIL_NUMBERS , $ passwordDefinition ->matchPassword ('abcdefgh ' ));
135+ $ this ->assertEquals (PasswordDefinition:: FAIL_NUMBERS , $ passwordDefinition ->matchPassword ('abcdefg1 ' ));
136+ $ this ->assertEquals (PasswordDefinition:: SUCCESS , $ passwordDefinition ->matchPassword ('abcdef11 ' ));
137137 }
138138
139139 public function testMatchPasswordWhitespace ()
@@ -148,7 +148,7 @@ public function testMatchPasswordWhitespace()
148148 PasswordDefinition::ALLOW_SEQUENTIAL => 1 , // Allow sequential characters
149149 PasswordDefinition::ALLOW_REPEATED => 1 // Allow repeated characters
150150 ]);
151- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('1234 678 ' ));
151+ $ this ->assertEquals (PasswordDefinition:: FAIL_WHITESPACE , $ passwordDefinition ->matchPassword ('1234 678 ' ));
152152 }
153153
154154 public function testMatchPasswordSequential ()
@@ -163,11 +163,11 @@ public function testMatchPasswordSequential()
163163 PasswordDefinition::ALLOW_SEQUENTIAL => 0 , // Allow sequential characters
164164 PasswordDefinition::ALLOW_REPEATED => 1 // Allow repeated characters
165165 ]);
166- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('123asdkls ' )); // 123 is sequential
167- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('sds456sks ' )); // 456 is sequential
168- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('aju654sks ' )); // 654 is sequential
169- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('791fghkalal ' )); // fgh is sequential
170- $ this ->assertTrue ( $ passwordDefinition ->matchPassword ('diykdsn132 ' ));
166+ $ this ->assertEquals (PasswordDefinition:: FAIL_SEQUENTIAL , $ passwordDefinition ->matchPassword ('123asdkls ' )); // 123 is sequential
167+ $ this ->assertEquals (PasswordDefinition:: FAIL_SEQUENTIAL , $ passwordDefinition ->matchPassword ('sds456sks ' )); // 456 is sequential
168+ $ this ->assertEquals (PasswordDefinition:: FAIL_SEQUENTIAL , $ passwordDefinition ->matchPassword ('aju654sks ' )); // 654 is sequential
169+ $ this ->assertEquals (PasswordDefinition:: FAIL_SEQUENTIAL , $ passwordDefinition ->matchPassword ('791fghkalal ' )); // fgh is sequential
170+ $ this ->assertEquals (PasswordDefinition:: SUCCESS , $ passwordDefinition ->matchPassword ('diykdsn132 ' ));
171171 }
172172
173173 public function testMatchCharsRepeated ()
@@ -183,9 +183,9 @@ public function testMatchCharsRepeated()
183183 PasswordDefinition::ALLOW_REPEATED => 0 // Allow repeated characters
184184 ]);
185185
186- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('hay111oihsc ' )); // 111 is repeated
187- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('haycccoihsc ' )); // ccc is repeated
188- $ this ->assertFalse ( $ passwordDefinition ->matchPassword ('oilalalapo ' )); // lalala is repeated
189- $ this ->assertTrue ( $ passwordDefinition ->matchPassword ('hay1d11oihsc ' ));
186+ $ this ->assertEquals (PasswordDefinition:: FAIL_REPEATED , $ passwordDefinition ->matchPassword ('hay111oihsc ' )); // 111 is repeated
187+ $ this ->assertEquals (PasswordDefinition:: FAIL_REPEATED , $ passwordDefinition ->matchPassword ('haycccoihsc ' )); // ccc is repeated
188+ $ this ->assertEquals (PasswordDefinition:: FAIL_REPEATED , $ passwordDefinition ->matchPassword ('oilalalapo ' )); // lalala is repeated
189+ $ this ->assertEquals (PasswordDefinition:: SUCCESS , $ passwordDefinition ->matchPassword ('hay1d11oihsc ' ));
190190 }
191191}
0 commit comments