18 public function testAccept($constraint, $ok_value, $error_value)
20 $this->assertFalse($constraint->accepts($ok_value));
21 $this->assertTrue($constraint->accepts($error_value));
27 public function testCheck($constraint, $ok_value, $error_value)
32 $constraint->check($ok_value);
37 $this->assertTrue($raised);
40 $constraint->check($error_value);
46 $this->assertFalse($raised);
54 $this->assertNull($constraint->problemWith($error_value));
55 $this->assertInternalType(
"string", $constraint->problemWith($ok_value));
63 $rf =
new Data\Factory();
64 $ok = $rf->ok($error_value);
65 $ok2 = $rf->ok($ok_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($ok_value));
91 $f =
new Validation\Factory(
new Data\
Factory());
93 return array(
array($f->not($f->isInt()), 2, 2.2),
94 array($f->not($f->greaterThan(5)), 6, 4),
95 array($f->not($f->lessThan(5)), 4, 6)
testRestrict($constraint, $ok_value, $error_value)
constraintsProvider
testWithProblemBuilder($constraint, $ok_value, $error_value)
constraintsProvider
TestCase for the factory of constraints.
testCheck($constraint, $ok_value, $error_value)
constraintsProvider
testProblemWith($constraint, $ok_value, $error_value)
constraintsProvider
Create styles array
The data for the language used.
testAccept($constraint, $ok_value, $error_value)
constraintsProvider