18 public function testAccept($constraint, $ok_value, $error_value)
20 $this->assertTrue($constraint->accepts($ok_value));
21 $this->assertFalse($constraint->accepts($error_value));
27 public function testCheck($constraint, $ok_value, $error_value)
31 $constraint->check($ok_value);
36 $this->assertFalse($raised);
39 $constraint->check($error_value);
44 $this->assertTrue($raised);
52 $this->assertNull($constraint->problemWith($ok_value));
53 $this->assertInternalType(
"string", $constraint->problemWith($error_value));
61 $rf =
new Data\Factory();
62 $ok = $rf->ok($ok_value);
63 $ok2 = $rf->ok($error_value);
64 $error = $rf->error(
"text");
67 $this->assertTrue(
$result->isOk());
69 $result = $constraint->restrict($ok2);
70 $this->assertTrue($result->isError());
72 $result = $constraint->restrict(
$error);
73 $this->assertSame(
$error, $result);
81 $new_constraint = $constraint->withProblemBuilder(
function () {
82 return "This was a vault";
84 $this->assertEquals(
"This was a vault", $new_constraint->problemWith($error_value));
89 $f =
new Validation\Factory(
new Data\
Factory());
92 array($f->greaterThan(5), 6, 4),
93 array($f->lessThan(5), 4, 6)
testAccept($constraint, $ok_value, $error_value)
constraintsProvider
TestCase for the factory of constraints.
testProblemWith($constraint, $ok_value, $error_value)
constraintsProvider
testCheck($constraint, $ok_value, $error_value)
constraintsProvider
Create styles array
The data for the language used.
testRestrict($constraint, $ok_value, $error_value)
constraintsProvider
testWithProblemBuilder($constraint, $ok_value, $error_value)
constraintsProvider