4 require_once
'libs/composer/vendor/autoload.php';
24 $this->assertTrue($constraint->
accepts($okValue));
25 $this->assertFalse($constraint->
accepts($errorValue));
39 $constraint->
check($errorValue);
44 $this->assertTrue($raised);
47 $constraint->
check($okValue);
53 $this->assertFalse($raised);
64 $this->assertNull($constraint->
problemWith($okValue));
65 $this->assertIsString($constraint->
problemWith($errorValue));
76 $rf =
new Data\Factory();
77 $ok = $rf->ok($okValue);
78 $ok2 = $rf->ok($errorValue);
79 $error = $rf->error(
'text');
82 $this->assertTrue(
$result->isOk());
85 $this->assertTrue($result->isError());
87 $result = $constraint->
applyTo($error);
88 $this->assertSame($error, $result);
100 return "This was a vault";
102 $this->assertEquals(
"This was a vault", $new_constraint->problemWith($errorValue));
110 $mock = $this->getMockBuilder(\ilLanguage::class)->disableOriginalConstructor()->getMock();
111 $data_factory =
new Data\Factory();
113 $refinery = new \ILIAS\Refinery\Factory($data_factory, $mock);
115 [$refinery->logical()->logicalOr([$refinery->int()->isLessThan(6), $refinery->int()->isGreaterThan(100)]),
'5', 8],
116 [$refinery->logical()->logicalOr([$refinery->int()->isGreaterThan(5), $refinery->int()->isLessThan(2)]), 7, 3]
problemWith($value)
Tells what the problem with the provided value is.
testRestrict(LogicalOr $constraint, $okValue, $errorValue)
constraintsProvider
testAccept(LogicalOr $constraint, $okValue, $errorValue)
constraintsProvider
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.
testProblemWith(LogicalOr $constraint, $okValue, $errorValue)
constraintsProvider
applyTo(Result $result)
Restricts a Result.
accepts($value)
Tells if the provided value complies.
testCheck(LogicalOr $constraint, $okValue, $errorValue)
constraintsProvider
check($value)
Checks the provided value.
testWithProblemBuilder(LogicalOr $constraint, $okValue, $errorValue)
constraintsProvider