4 require_once(
"libs/composer/vendor/autoload.php");
18 $this->df =
new Data\Factory();
19 $this->lng = $this->createMock(\ilLanguage::class);
20 $this->f =
new Validation\Factory($this->df, $this->lng);
22 $this->less_than_3 = $this->f->custom(
29 $this->less_than_5 = $this->f->custom(
36 $this->c = $this->f->parallel([$this->less_than_3, $this->less_than_5]);
41 $this->assertTrue($this->c->accepts(2));
46 $this->assertFalse($this->c->accepts(4));
52 $this->assertTrue(
true);
57 $this->expectException(\UnexpectedValueException::class);
63 $this->assertNull($this->c->problemWith(2));
69 ->expects($this->never())
72 $this->assertEquals(
"not_less_than_3", $this->c->problemWith(4));
78 ->expects($this->never())
81 $this->assertEquals(
"not_less_than_3 not_less_than_5", $this->c->problemWith(6));
86 $ok = $this->df->ok(2);
89 $this->assertTrue(
$res->isOk());
94 $not_ok = $this->df->ok(7);
96 $res = $this->c->restrict($not_ok);
97 $this->assertFalse(
$res->isOk());
102 $error = $this->df->error(
"error");
104 $res = $this->c->restrict($error);
105 $this->assertSame($error,
$res);
110 $new_c = $this->c->withProblemBuilder(
function () {
111 return "This was a fault";
113 $this->assertEquals(
"This was a fault", $new_c->problemWith(7));
foreach($_POST as $key=> $value) $res
TestCase for the parellel constraint.