19 declare(strict_types=1);
29 #[DataProvider('constraintsProvider')] 32 $this->assertTrue($constraint->
accepts($okValue));
33 $this->assertFalse($constraint->
accepts($errorValue));
36 #[DataProvider('constraintsProvider')] 42 $constraint->
check($errorValue);
47 $this->assertTrue($raised);
50 $constraint->
check($okValue);
56 $this->assertFalse($raised);
59 #[DataProvider('constraintsProvider')] 62 $this->assertNull($constraint->
problemWith($okValue));
63 $this->assertIsString($constraint->
problemWith($errorValue));
66 #[DataProvider('constraintsProvider')] 70 $ok = $rf->ok($okValue);
71 $ok2 = $rf->ok($errorValue);
72 $error = $rf->error(
'text');
74 $result = $constraint->
applyTo($ok);
75 $this->assertTrue($result->isOk());
77 $result = $constraint->
applyTo($ok2);
78 $this->assertTrue($result->isError());
80 $result = $constraint->
applyTo($error);
81 $this->assertSame($error, $result);
84 #[DataProvider('constraintsProvider')] 88 return "This was a vault";
90 $this->assertEquals(
"This was a vault", $new_constraint->problemWith($errorValue));
98 $language =
new class () implements \
ILIAS\Language\Language {
99 public function txt(
string $a_topic,
string $a_default_lang_fallback_mod =
""):
string 103 public function loadLanguageModule(
string $a_module):
void 106 public function getLangKey():
string 110 public function toJS($key):
void
problemWith($value)
Tells what the problem with the provided value is.
Interface Observer Contains several chained tasks and infos about them.
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.
testRestrict(LogicalOr $constraint, mixed $okValue, mixed $errorValue)
applyTo(Result $result)
Restricts a Result.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testAccept(LogicalOr $constraint, mixed $okValue, mixed $errorValue)
testCheck(LogicalOr $constraint, mixed $okValue, mixed $errorValue)
testWithProblemBuilder(LogicalOr $constraint, mixed $okValue, mixed $errorValue)
static constraintsProvider()
accepts($value)
Tells if the provided value complies.
check($value)
Checks the provided value.
testProblemWith(LogicalOr $constraint, mixed $okValue, mixed $errorValue)