19declare(strict_types=1);
24use PHPUnit\Framework\TestCase;
28 private DataFactory
$df;
34 protected function setUp(): void
36 $this->df =
new DataFactory();
37 $this->
lng = $this->createMock(
ILIAS\Language\Language::class);
38 $this->
refinery =
new Refinery($this->df, $this->
lng);
42 $this->not_true = $this->
refinery->logical()->not($group->constraint(
43 static function ($v):
bool {
49 $this->not_false = $this->
refinery->logical()->not($group->constraint(
50 static function ($v):
bool {
59 $this->assertTrue($this->not_false->accepts(
null));
64 $this->assertFalse($this->not_true->accepts(
null));
69 $this->not_false->check(
null);
70 $this->assertTrue(
true);
75 $this->expectException(UnexpectedValueException::class);
76 $this->not_true->check(
null);
81 $this->assertNull($this->not_false->problemWith(
null));
87 ->expects($this->once())
92 $this->assertEquals(
"-not_true-", $this->not_true->problemWith(
null));
97 $ok = $this->df->ok(
null);
99 $res = $this->not_false->applyTo($ok);
100 $this->assertTrue(
$res->isOk());
105 $not_ok = $this->df->ok(
null);
107 $res = $this->not_true->applyTo($not_ok);
108 $this->assertFalse(
$res->isOk());
113 $error = $this->df->error(
"error");
115 $res = $this->not_false->applyTo($error);
116 $this->assertSame($error,
$res);
121 $new_c = $this->not_true->withProblemBuilder(
static function ():
string {
122 return "This was a fault";
124 $this->assertEquals(
"This was a fault", $new_c->problemWith(
null));
ILIAS Language Language $lng
A constraint encodes some resrtictions on values.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.