20 $this->assertTrue($constraint->accepts($ok_value));
21 $this->assertFalse($constraint->accepts($error_value));
31 $constraint->check($ok_value);
36 $this->assertFalse($raised);
39 $constraint->check($error_value);
41 $this->assertEquals(
$message, $e->getMessage());
45 $this->assertTrue($raised);
53 $this->assertNull($constraint->problemWith($ok_value));
54 $this->assertInternalType(
"string", $constraint->problemWith($error_value));
55 $this->assertEquals(
$message, $constraint->problemWith($error_value));
63 $rf =
new Data\Factory();
64 $ok = $rf->ok($ok_value);
65 $ok2 = $rf->ok($error_value);
66 $error = $rf->error(
"text");
69 $this->assertTrue(
$result->isOk());
71 $result = $constraint->restrict($ok2);
72 $this->assertTrue($result->isError());
74 $result = $constraint->restrict(
$error);
75 $this->assertSame(
$error, $result);
83 $new_constraint = $constraint->withProblemBuilder(
function () {
84 return "This was a vault";
86 $this->assertEquals(
"This was a vault", $new_constraint->problemWith($error_value));
91 $f =
new Validation\Factory(
new Data\
Factory());
93 return array(
array($f->custom(function ($value) {
95 },
"Value is not greater"), 2, 1,
"Value is not greater"),
96 array($f->custom(function ($value) {
98 },
"Value is not greater"), 1, 2,
"Value is not greater")
TestCase for the factory of constraints.
testProblemWith($constraint, $ok_value, $error_value, $message)
constraintsProvider
testAccept($constraint, $ok_value, $error_value, $message)
constraintsProvider
testCheck($constraint, $ok_value, $error_value, $message)
constraintsProvider
catch(Exception $e) $message
testWithProblemBuilder($constraint, $ok_value, $error_value, $message)
constraintsProvider
Create styles array
The data for the language used.
testRestrict($constraint, $ok_value, $error_value, $message)
constraintsProvider