Definition at line 10 of file NotConstraintTest.php.
◆ setUp()
Definition at line 37 of file NotConstraintTest.php.
37 : void
38 {
39 $this->df = new Data\Factory();
40 $this->lng = $this->createMock(\ilLanguage::class);
41 $this->refinery = new \ILIAS\Refinery\Factory($this->df, $this->lng);
42
43 $group = $this->refinery->custom();
44
45 $this->not_true = $this->refinery->logical()->not($group->constraint(
46 function ($v) {
47 return true;
48 },
49 "not_true"
50 ));
51
52 $this->not_false = $this->refinery->logical()->not($group->constraint(
53 function ($v) {
54 return false;
55 },
56 "not_false"
57 ));
58 }
◆ testAccepts()
Definition at line 60 of file NotConstraintTest.php.
61 {
62 $this->assertTrue($this->not_false->accepts(null));
63 }
◆ testCheckFails()
NotTest::testCheckFails |
( |
| ) |
|
Definition at line 76 of file NotConstraintTest.php.
77 {
78 $this->expectException(\UnexpectedValueException::class);
79 $this->not_true->check(null);
80 }
◆ testCheckSucceed()
NotTest::testCheckSucceed |
( |
| ) |
|
Definition at line 70 of file NotConstraintTest.php.
71 {
72 $this->not_false->check(null);
73 $this->assertTrue(true);
74 }
◆ testNoProblemWith()
NotTest::testNoProblemWith |
( |
| ) |
|
Definition at line 82 of file NotConstraintTest.php.
83 {
84 $this->assertNull($this->not_false->problemWith(null));
85 }
◆ testNotAccepts()
NotTest::testNotAccepts |
( |
| ) |
|
Definition at line 65 of file NotConstraintTest.php.
66 {
67 $this->assertFalse($this->not_true->accepts(null));
68 }
◆ testProblemWith()
NotTest::testProblemWith |
( |
| ) |
|
Definition at line 87 of file NotConstraintTest.php.
88 {
89 $this->lng
90 ->expects($this->once())
91 ->method("txt")
92 ->with("not_generic")
93 ->willReturn("-%s-");
94
95 $this->assertEquals("-not_true-", $this->not_true->problemWith(null));
96 }
◆ testRestrictError()
NotTest::testRestrictError |
( |
| ) |
|
Definition at line 114 of file NotConstraintTest.php.
115 {
116 $error = $this->df->error("error");
117
118 $res = $this->not_false->applyTo($error);
119 $this->assertSame($error,
$res);
120 }
foreach($_POST as $key=> $value) $res
References $res.
◆ testRestrictNotOk()
NotTest::testRestrictNotOk |
( |
| ) |
|
Definition at line 106 of file NotConstraintTest.php.
107 {
108 $not_ok = $this->df->ok(null);
109
110 $res = $this->not_true->applyTo($not_ok);
111 $this->assertFalse(
$res->isOk());
112 }
References $res.
◆ testRestrictOk()
NotTest::testRestrictOk |
( |
| ) |
|
◆ testWithProblemBuilder()
NotTest::testWithProblemBuilder |
( |
| ) |
|
Definition at line 122 of file NotConstraintTest.php.
123 {
124 $new_c = $this->not_true->withProblemBuilder(function () {
125 return "This was a fault";
126 });
127 $this->assertEquals("This was a fault", $new_c->problemWith(null));
128 }
◆ $df
◆ $lng
◆ $not_false
◆ $not_true
◆ $refinery
The documentation for this class was generated from the following file: