Test standard-constraints of a password.
More...
◆ constraintsProvider()
PasswordContraintsTest::constraintsProvider |
( |
| ) |
|
Test a set of values.
- Returns
- array[[$constraint,$ok_values,$error_values]]
Definition at line 23 of file PasswordContraintsTest.php.
24 {
25 $lng = $this->createMock(\ilLanguage::class);
26 $d = new \ILIAS\Data\Factory();
27 $validation = new \ILIAS\Validation\Factory(
$d,
$lng);
28 $v = $validation->password();
29
30 return array(
31 array(
32 $v->hasMinLength(3),
33 [
$d->password(
'abc'),
$d->password(
'abcd')],
34 [
$d->password(
'a'),
$d->password(
'ab')]
35 ),
36 array(
37 $v->hasLowerChars(),
38 [
$d->password(
'abc'),
$d->password(
'AbC')],
39 [
$d->password(
'AB'),
$d->password(
'21'),
$d->password(
'#*+')]
40 ),
41
42 array(
43 $v->hasUpperChars(),
44 [
$d->password(
'Abc'),
$d->password(
'ABC')],
45 [
$d->password(
'abc'),
$d->password(
'21'),
$d->password(
'#*+')]
46 ),
47 array(
48 $v->hasNumbers(),
49 [
$d->password(
'Ab1'),
$d->password(
'123')],
50 [
$d->password(
'abc'),
$d->password(
'ABC'),
$d->password(
'#*+')]
51 ),
52
53 array(
54 $v->hasSpecialChars(),
55 [
$d->password(
'Ab+'),
$d->password(
'123#')],
56 [
$d->password(
'abc'),
$d->password(
'ABC'),
$d->password(
'123')]
57 )
58 );
59 }
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
References $d, and $lng.
◆ testAccept()
PasswordContraintsTest::testAccept |
( |
|
$constraint, |
|
|
|
$ok_values, |
|
|
|
$error_values |
|
) |
| |
@dataProvider constraintsProvider
Definition at line 64 of file PasswordContraintsTest.php.
65 {
66 foreach ($ok_values as $ok_value) {
67 $this->assertTrue($constraint->accepts($ok_value));
68 }
69 foreach ($error_values as $error_value) {
70 $this->assertFalse($constraint->accepts($error_value));
71 }
72 }
The documentation for this class was generated from the following file: