19declare(strict_types=1);
24use PHPUnit\Framework\TestCase;
28 private DataFactory
$df;
31 protected function setUp(): void
33 $this->df =
new DataFactory();
39 $this->assertTrue($this->c->accepts(4));
44 $this->assertFalse($this->c->accepts(2));
50 $this->assertTrue(
true);
55 $this->expectException(UnexpectedValueException::class);
61 $this->assertNull($this->c->problemWith(4));
66 $lng = $this->createMock(
ILIAS\Language\Language::class);
68 ->expects($this->never())
76 $lng = $this->createMock(
ILIAS\Language\Language::class);
78 ->expects($this->never())
86 $ok = $this->df->ok(4);
88 $res = $this->c->applyTo($ok);
89 $this->assertTrue(
$res->isOk());
94 $not_ok = $this->df->ok(7);
96 $res = $this->c->applyTo($not_ok);
97 $this->assertFalse(
$res->isOk());
102 $error = $this->df->error(
'error');
104 $res = $this->c->applyTo($error);
105 $this->assertSame($error,
$res);
110 $new_c = $this->c->withProblemBuilder(
static fn():
string =>
'This was a fault');
111 $this->assertEquals(
'This was a fault', $new_c->problemWith(7));
119 $greater_than_3 = $group->constraint(
120 fn($value) => $value > 3,
124 $less_than_5 = $group->constraint(
125 fn($value) => $value < 5,
129 return $refinery->logical()->sequential([$greater_than_3, $less_than_5]);
sequentialConstraint(ILIAS\Language\Language $lng)
A constraint encodes some resrtictions on values.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
foreach($_POST as $key=> $value) $res