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 24 of file PasswordContraintsTest.php.
25 {
26 $lng = $this->createMock(\ilLanguage::class);
27 $d = new \ILIAS\Data\Factory();
28 $refinery = new \ILIAS\Refinery\Factory(
$d,
$lng);
29 $v = $refinery->password();
30
31 return array(
32 array(
33 $v->hasMinLength(3),
34 [
$d->password(
'abc'),
$d->password(
'abcd')],
35 [
$d->password(
'a'),
$d->password(
'ab')]
36 ),
37 array(
38 $v->hasLowerChars(),
39 [
$d->password(
'abc'),
$d->password(
'AbC')],
40 [
$d->password(
'AB'),
$d->password(
'21'),
$d->password(
'#*+')]
41 ),
42
43 array(
44 $v->hasUpperChars(),
45 [
$d->password(
'Abc'),
$d->password(
'ABC')],
46 [
$d->password(
'abc'),
$d->password(
'21'),
$d->password(
'#*+')]
47 ),
48 array(
49 $v->hasNumbers(),
50 [
$d->password(
'Ab1'),
$d->password(
'123')],
51 [
$d->password(
'abc'),
$d->password(
'ABC'),
$d->password(
'#*+')]
52 ),
53
54 array(
55 $v->hasSpecialChars(),
56 [
$d->password(
'Ab+'),
$d->password(
'123#')],
57 [
$d->password(
'abc'),
$d->password(
'ABC'),
$d->password(
'123')]
58 )
59 );
60 }
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 65 of file PasswordContraintsTest.php.
66 {
67 foreach ($ok_values as $ok_value) {
68 $this->assertTrue($constraint->accepts($ok_value));
69 }
70 foreach ($error_values as $error_value) {
71 $this->assertFalse($constraint->accepts($error_value));
72 }
73 }
The documentation for this class was generated from the following file: