4require_once
'libs/composer/vendor/autoload.php';
24 $this->assertTrue($constraint->
accepts($okValue));
25 $this->assertFalse($constraint->
accepts($errorValue));
39 $constraint->
check($errorValue);
40 }
catch (\UnexpectedValueException $e) {
44 $this->assertTrue($raised);
47 $constraint->
check($okValue);
49 }
catch (\UnexpectedValueException $e) {
53 $this->assertFalse($raised);
64 $this->assertNull($constraint->
problemWith($okValue));
65 $this->assertInternalType(
'string', $constraint->
problemWith($errorValue));
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());
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();
114 [
$f->or([
$f->isInt(),
$f->isString()]),
'5', []],
115 [
$f->or([
$f->greaterThan(5),
$f->lessThan(2)]), 7, 3]
An exception for terminatinating execution or to throw for unit testing.
accepts($value)
Tells if the provided value complies.bool
problemWith($value)
Tells what the problem with the provided value is.Should return null if accepts($value)....
check($value)
Checks the provided value.Should not throw if accepts($value).UnexpectedValueException if value does ...
restrict(Result $result)
Restricts a Result.Must do nothing with the result if $result->isError(). Must replace the result wit...
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.problemWith() must return an...
testRestrict(LogicalOr $constraint, $okValue, $errorValue)
@dataProvider constraintsProvider
testWithProblemBuilder(LogicalOr $constraint, $okValue, $errorValue)
@dataProvider constraintsProvider
testAccept(LogicalOr $constraint, $okValue, $errorValue)
@dataProvider constraintsProvider
testProblemWith(LogicalOr $constraint, $okValue, $errorValue)
@dataProvider constraintsProvider
testCheck(LogicalOr $constraint, $okValue, $errorValue)
@dataProvider constraintsProvider