4require_once
'libs/composer/vendor/autoload.php';
8use PHPUnit\Framework\TestCase;
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));
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();
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]
An exception for terminatinating execution or to throw for unit testing.
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
accepts($value)
Tells if the provided value complies.
applyTo(Result $result)
Restricts a Result.
check($value)
Checks the provided value.
problemWith($value)
Tells what the problem with the provided value is.
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.