ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PasswordContraintsTest Class Reference
+ Inheritance diagram for PasswordContraintsTest:
+ Collaboration diagram for PasswordContraintsTest:

Public Member Functions

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

Static Public Member Functions

static constraintsProvider ()
 Test a set of values. More...
 

Detailed Description

Definition at line 25 of file PasswordContraintsTest.php.

Member Function Documentation

◆ 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.

References Vendor\Package\$d, $lng, and ILIAS\UI\examples\Layout\Page\Standard\$refinery.

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();
51  $refinery = new \ILIAS\Refinery\Factory($d, $lng);
52  $v = $refinery->password();
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 Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31

◆ testAccept()

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

Definition at line 91 of file PasswordContraintsTest.php.

References ILIAS\Refinery\Constraint\accepts().

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.
+ Here is the call graph for this function:

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