Definition at line 25 of file PasswordContraintsTest.php.
◆ constraintsProvider()
static PasswordContraintsTest::constraintsProvider |
( |
| ) |
|
|
static |
Test a set of values.
- Returns
- array[[$constraint,$ok_values,$error_values]]
Definition at line 32 of file PasswordContraintsTest.php.
32 : array
33 {
34 $lng =
new class () implements \
ILIAS\Language\Language {
35 public function txt(string $a_topic, string $a_default_lang_fallback_mod = ""): string
36 {
37 return $a_topic;
38 }
39 public function loadLanguageModule(string $a_module): void
40 {
41 }
42 public function getLangKey(): string
43 {
44 return '';
45 }
46 public function toJS($key): void
47 {
48 }
49 };
50 $d = new \ILIAS\Data\Factory();
53
54 return [
55 [
56 $v->hasMinLength(3),
57 [
$d->password(
'abc'),
$d->password(
'abcd')],
58 [
$d->password(
'a'),
$d->password(
'ab')]
59 ],
60 [
61 $v->hasLowerChars(),
62 [
$d->password(
'abc'),
$d->password(
'AbC')],
63 [
$d->password(
'AB'),
$d->password(
'21'),
$d->password(
'#*+')]
64 ],
65
66 [
67 $v->hasUpperChars(),
68 [
$d->password(
'Abc'),
$d->password(
'ABC')],
69 [
$d->password(
'abc'),
$d->password(
'21'),
$d->password(
'#*+')]
70 ],
71 [
72 $v->hasNumbers(),
73 [
$d->password(
'Ab1'),
$d->password(
'123')],
74 [
$d->password(
'abc'),
$d->password(
'ABC'),
$d->password(
'#*+')]
75 ],
76
77 [
78 $v->hasSpecialChars(),
79 [
$d->password(
'Ab+'),
$d->password(
'123#')],
80 [
$d->password(
'abc'),
$d->password(
'ABC'),
$d->password(
'123')]
81 ]
82 ];
83 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
References Vendor\Package\$d, $lng, and ILIAS\UI\examples\Layout\Page\Standard\$refinery.
◆ testAccept()
PasswordContraintsTest::testAccept |
( |
Constraint |
$constraint, |
|
|
array |
$ok_values, |
|
|
array |
$error_values |
|
) |
| |
- Parameters
-
Constraint | $constraint | |
ILIAS\Data\Password[] | $ok_values | |
ILIAS\Data\Password[] | $error_values | |
Definition at line 91 of file PasswordContraintsTest.php.
91 : void
92 {
93 foreach ($ok_values as $ok_value) {
94 $this->assertTrue($constraint->
accepts($ok_value));
95 }
96 foreach ($error_values as $error_value) {
97 $this->assertFalse($constraint->
accepts($error_value));
98 }
99 }
accepts($value)
Tells if the provided value complies.
References ILIAS\Refinery\Constraint\accepts().
The documentation for this class was generated from the following file: