TestCase for the parellel constraint.
More...
◆ setUp()
Definition at line 32 of file ParallelConstraintsTest.php.
32 : void
33 {
34 $this->df = new Data\Factory();
35 $this->lng = $this->createMock(\ilLanguage::class);
36 $this->refinery = new \ILIAS\Refinery\Factory($this->df, $this->lng);
37
38 $group = $this->refinery->custom();
39
40 $this->less_than_3 = $group->constraint(
41 function ($value) {
42 return $value < 3;
43 },
44 "not_less_than_3"
45 );
46
47 $this->less_than_5 = $group->constraint(
48 function ($value) {
49 return $value < 5;
50 },
51 "not_less_than_5"
52 );
53
54 $this->c = $this->refinery
55 ->logical()
56 ->parallel([$this->less_than_3, $this->less_than_5]);
57 }
◆ testAccepts()
ParallelTest::testAccepts |
( |
| ) |
|
◆ testCheckFails()
ParallelTest::testCheckFails |
( |
| ) |
|
Definition at line 75 of file ParallelConstraintsTest.php.
76 {
77 $this->expectException(\UnexpectedValueException::class);
78 $this->c->check(6);
79 }
◆ testCheckSucceed()
ParallelTest::testCheckSucceed |
( |
| ) |
|
◆ testNoProblemWith()
ParallelTest::testNoProblemWith |
( |
| ) |
|
◆ testNotAccepts()
ParallelTest::testNotAccepts |
( |
| ) |
|
◆ testProblemWith1()
ParallelTest::testProblemWith1 |
( |
| ) |
|
Definition at line 86 of file ParallelConstraintsTest.php.
87 {
88 $this->lng
89 ->expects($this->never())
90 ->method("txt");
91
92 $this->assertEquals("not_less_than_3", $this->c->problemWith(4));
93 }
◆ testProblemWith2()
ParallelTest::testProblemWith2 |
( |
| ) |
|
Definition at line 95 of file ParallelConstraintsTest.php.
96 {
97 $this->lng
98 ->expects($this->never())
99 ->method("txt");
100
101 $this->assertEquals("not_less_than_3 not_less_than_5", $this->c->problemWith(6));
102 }
◆ testRestrictError()
ParallelTest::testRestrictError |
( |
| ) |
|
Definition at line 120 of file ParallelConstraintsTest.php.
121 {
122 $error = $this->df->error("error");
123
124 $res = $this->c->applyTo($error);
125 $this->assertSame($error,
$res);
126 }
foreach($_POST as $key=> $value) $res
References $res.
◆ testRestrictNotOk()
ParallelTest::testRestrictNotOk |
( |
| ) |
|
◆ testRestrictOk()
ParallelTest::testRestrictOk |
( |
| ) |
|
◆ testWithProblemBuilder()
ParallelTest::testWithProblemBuilder |
( |
| ) |
|
Definition at line 128 of file ParallelConstraintsTest.php.
129 {
130 $new_c = $this->c->withProblemBuilder(function () {
131 return "This was a fault";
132 });
133 $this->assertEquals("This was a fault", $new_c->problemWith(7));
134 }
◆ $df
◆ $lng
◆ $refinery
The documentation for this class was generated from the following file: