19 declare(strict_types=1);
    33     protected function setUp(): void
    36         $this->
lng = $this->createMock(ilLanguage::class);
    41         $less_than_3 = $group->constraint(
    42             static function ($value): 
bool {
    48         $less_than_5 = $group->constraint(
    49             static function ($value): 
bool {
    57             ->parallel([$less_than_3, $less_than_5]);
    62         $this->assertTrue($this->c->accepts(2));
    67         $this->assertFalse($this->c->accepts(4));
    73         $this->assertTrue(
true); 
    78         $this->expectException(UnexpectedValueException::class);
    84         $this->assertNull($this->c->problemWith(2));
    90             ->expects($this->never())
    93         $this->assertEquals(
"not_less_than_3", $this->c->problemWith(4));
    99             ->expects($this->never())
   102         $this->assertEquals(
"not_less_than_3 not_less_than_5", $this->c->problemWith(6));
   107         $ok = $this->df->ok(2);
   109         $res = $this->c->applyTo($ok);
   110         $this->assertTrue(
$res->isOk());
   115         $not_ok = $this->df->ok(7);
   117         $res = $this->c->applyTo($not_ok);
   118         $this->assertFalse(
$res->isOk());
   123         $error = $this->df->error(
"error");
   125         $res = $this->c->applyTo($error);
   126         $this->assertSame($error, 
$res);
   131         $new_c = $this->c->withProblemBuilder(
static function (): 
string {
   132             return "This was a fault";
   134         $this->assertEquals(
"This was a fault", $new_c->problemWith(7));
 
A constraint encodes some resrtictions on values.