ILIAS  release_8 Revision v8.23
PasswordContraintsTest Class Reference
+ Inheritance diagram for PasswordContraintsTest:
+ Collaboration diagram for PasswordContraintsTest:

Public Member Functions

 constraintsProvider ()
 Test a set of values. More...
 
 testAccept (Constraint $constraint, array $ok_values, array $error_values)
 constraintsProvider More...
 

Detailed Description

Definition at line 24 of file PasswordContraintsTest.php.

Member Function Documentation

◆ constraintsProvider()

PasswordContraintsTest::constraintsProvider ( )

Test a set of values.

Returns
array[[$constraint,$ok_values,$error_values]]

Definition at line 31 of file PasswordContraintsTest.php.

References $d, $lng, ILIAS\Repository\$refinery, and ILIAS\Data\Factory\password().

31  : array
32  {
33  $lng = $this->createMock(\ilLanguage::class);
34  $d = new \ILIAS\Data\Factory();
35  $refinery = new \ILIAS\Refinery\Factory($d, $lng);
36  $v = $refinery->password();
37 
38  return [
39  [
40  $v->hasMinLength(3),
41  [$d->password('abc'), $d->password('abcd')],
42  [$d->password('a'), $d->password('ab')]
43  ],
44  [
45  $v->hasLowerChars(),
46  [$d->password('abc'), $d->password('AbC')],
47  [$d->password('AB'), $d->password('21'), $d->password('#*+')]
48  ],
49 
50  [
51  $v->hasUpperChars(),
52  [$d->password('Abc'), $d->password('ABC')],
53  [$d->password('abc'), $d->password('21'), $d->password('#*+')]
54  ],
55  [
56  $v->hasNumbers(),
57  [$d->password('Ab1'), $d->password('123')],
58  [$d->password('abc'), $d->password('ABC'), $d->password('#*+')]
59  ],
60 
61  [
62  $v->hasSpecialChars(),
63  [$d->password('Ab+'), $d->password('123#')],
64  [$d->password('abc'), $d->password('ABC'), $d->password('123')]
65  ]
66  ];
67  }
password(string $pass)
Definition: Factory.php:98
$lng
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
Refinery Factory $refinery
+ Here is the call graph for this function:

◆ testAccept()

PasswordContraintsTest::testAccept ( Constraint  $constraint,
array  $ok_values,
array  $error_values 
)

constraintsProvider

Parameters
Constraint$constraint
ILIAS

Definition at line 75 of file PasswordContraintsTest.php.

References ILIAS\Refinery\Constraint\accepts().

75  : void
76  {
77  foreach ($ok_values as $ok_value) {
78  $this->assertTrue($constraint->accepts($ok_value));
79  }
80  foreach ($error_values as $error_value) {
81  $this->assertFalse($constraint->accepts($error_value));
82  }
83  }
accepts($value)
Tells if the provided value complies.
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: