Definition at line 9 of file NotConstraintTest.php.
◆ setUp()
Definition at line 11 of file NotConstraintTest.php.
12 {
13 $this->df = new Data\Factory();
14 $this->lng = $this->createMock(\ilLanguage::class);
15 $this->f = new Validation\Factory($this->df, $this->lng);
16
17 $this->not_true = $this->f->not($this->f->custom(
18 function ($v) {
19 return true;
20 },
21 "not_true"
22 ));
23
24 $this->not_false = $this->f->not($this->f->custom(
25 function ($v) {
26 return false;
27 },
28 "not_false"
29 ));
30 }
◆ testAccepts()
Definition at line 32 of file NotConstraintTest.php.
33 {
34 $this->assertTrue($this->not_false->accepts(null));
35 }
◆ testCheckFails()
NotTest::testCheckFails |
( |
| ) |
|
Definition at line 48 of file NotConstraintTest.php.
49 {
50 $this->expectException(\UnexpectedValueException::class);
51 $this->not_true->check(null);
52 }
◆ testCheckSucceed()
NotTest::testCheckSucceed |
( |
| ) |
|
Definition at line 42 of file NotConstraintTest.php.
43 {
44 $this->not_false->check(null);
45 $this->assertTrue(true);
46 }
◆ testNoProblemWith()
NotTest::testNoProblemWith |
( |
| ) |
|
Definition at line 54 of file NotConstraintTest.php.
55 {
56 $this->assertNull($this->not_false->problemWith(null));
57 }
◆ testNotAccepts()
NotTest::testNotAccepts |
( |
| ) |
|
Definition at line 37 of file NotConstraintTest.php.
38 {
39 $this->assertFalse($this->not_true->accepts(null));
40 }
◆ testProblemWith()
NotTest::testProblemWith |
( |
| ) |
|
Definition at line 59 of file NotConstraintTest.php.
60 {
61 $this->lng
62 ->expects($this->
once())
63 ->method("txt")
64 ->with("not_generic")
65 ->willReturn("-%s-");
66
67 $this->assertEquals("-not_true-", $this->not_true->problemWith(null));
68 }
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
References Sabre\Event\once().
◆ testRestrictError()
NotTest::testRestrictError |
( |
| ) |
|
Definition at line 86 of file NotConstraintTest.php.
87 {
88 $error = $this->df->error("error");
89
90 $res = $this->not_false->restrict($error);
91 $this->assertSame($error,
$res);
92 }
foreach($_POST as $key=> $value) $res
References $res.
◆ testRestrictNotOk()
NotTest::testRestrictNotOk |
( |
| ) |
|
Definition at line 78 of file NotConstraintTest.php.
79 {
80 $not_ok = $this->df->ok(null);
81
82 $res = $this->not_true->restrict($not_ok);
83 $this->assertFalse(
$res->isOk());
84 }
References $res.
◆ testRestrictOk()
NotTest::testRestrictOk |
( |
| ) |
|
◆ testWithProblemBuilder()
NotTest::testWithProblemBuilder |
( |
| ) |
|
Definition at line 94 of file NotConstraintTest.php.
95 {
96 $new_c = $this->not_true->withProblemBuilder(function () {
97 return "This was a fault";
98 });
99 $this->assertEquals("This was a fault", $new_c->problemWith(null));
100 }
The documentation for this class was generated from the following file: