TestCase for the sequential constraint.
More...
◆ setUp()
SequentialTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 42 of file SequentialConstraintTest.php.
42 : void
43 {
44 $this->df = new Data\Factory();
45 $this->lng = $this->createMock(\ilLanguage::class);
46 $this->refinery = new \ILIAS\Refinery\Factory($this->df, $this->lng);
47
48 $group = $this->refinery->custom();
49
50 $this->greater_than_3 = $group->constraint(
51 function ($value) {
52 return $value > 3;
53 },
54 "not_greater_than_3"
55 );
56
57 $this->less_than_5 = $group->constraint(
58 function ($value) {
59 return $value < 5;
60 },
61 "not_less_than_5"
62 );
63
64 $this->c = $this->refinery
65 ->logical()
66 ->sequential([$this->greater_than_3, $this->less_than_5]);
67 }
◆ testAccepts()
SequentialTest::testAccepts |
( |
| ) |
|
◆ testCheckFails()
SequentialTest::testCheckFails |
( |
| ) |
|
Definition at line 85 of file SequentialConstraintTest.php.
86 {
87 $this->expectException(\UnexpectedValueException::class);
88 $this->c->check(2);
89 }
◆ testCheckSucceed()
SequentialTest::testCheckSucceed |
( |
| ) |
|
◆ testNoProblemWith()
SequentialTest::testNoProblemWith |
( |
| ) |
|
◆ testNotAccepts()
SequentialTest::testNotAccepts |
( |
| ) |
|
◆ testProblemWith1()
SequentialTest::testProblemWith1 |
( |
| ) |
|
Definition at line 96 of file SequentialConstraintTest.php.
97 {
98 $this->lng
99 ->expects($this->never())
100 ->method("txt");
101
102 $this->assertEquals("not_greater_than_3", $this->c->problemWith(2));
103 }
◆ testProblemWith2()
SequentialTest::testProblemWith2 |
( |
| ) |
|
Definition at line 105 of file SequentialConstraintTest.php.
106 {
107 $this->lng
108 ->expects($this->never())
109 ->method("txt");
110
111 $this->assertEquals("not_less_than_5", $this->c->problemWith(6));
112 }
◆ testRestrictError()
SequentialTest::testRestrictError |
( |
| ) |
|
Definition at line 130 of file SequentialConstraintTest.php.
131 {
132 $error = $this->df->error("error");
133
134 $res = $this->c->applyTo($error);
135 $this->assertSame($error,
$res);
136 }
foreach($_POST as $key=> $value) $res
References $res.
◆ testRestrictNotOk()
SequentialTest::testRestrictNotOk |
( |
| ) |
|
◆ testRestrictOk()
SequentialTest::testRestrictOk |
( |
| ) |
|
◆ testWithProblemBuilder()
SequentialTest::testWithProblemBuilder |
( |
| ) |
|
Definition at line 138 of file SequentialConstraintTest.php.
139 {
140 $new_c = $this->c->withProblemBuilder(function () {
141 return "This was a fault";
142 });
143 $this->assertEquals("This was a fault", $new_c->problemWith(7));
144 }
◆ $df
◆ $greater_than_3
SequentialTest::$greater_than_3 |
|
private |
◆ $less_than_5
SequentialTest::$less_than_5 |
|
private |
◆ $lng
◆ $refinery
SequentialTest::$refinery |
|
private |
The documentation for this class was generated from the following file: