3 declare(strict_types=1);
33 protected function setUp(): void
36 $this->
lng = $this->createMock(ilLanguage::class);
38 $this->max_length = 2;
49 $this->assertTrue($this->c->accepts(
"12"));
54 $this->assertTrue($this->c->accepts(
"1"));
59 $this->assertFalse($this->c->accepts(
"123"));
64 $this->c->check(
"12");
65 $this->assertTrue(
true);
70 $this->expectException(\UnexpectedValueException::class);
71 $this->c->check(
"123");
76 $this->assertNull($this->c->problemWith(
"12"));
82 ->expects($this->once())
84 ->with(
"not_max_length")
87 $this->assertEquals(
"-2-", $this->c->problemWith(
"123"));
92 $ok = $this->df->ok(
"12");
94 $res = $this->c->applyTo($ok);
95 $this->assertTrue(
$res->isOk());
100 $not_ok = $this->df->ok(
"123");
102 $res = $this->c->applyTo($not_ok);
103 $this->assertFalse(
$res->isOk());
108 $error = $this->df->error(
"error");
110 $res = $this->c->applyTo($error);
111 $this->assertSame($error,
$res);
116 $new_c = $this->c->withProblemBuilder(
static function ():
string {
117 return "This was a fault";
119 $this->assertEquals(
"This was a fault", $new_c->problemWith(
"123"));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A constraint encodes some resrtictions on values.