TestCase for the factory of constraints.
More...
◆ setUp()
SequentialTest::setUp |
( |
| ) |
|
|
protected |
◆ tearDown()
SequentialTest::tearDown |
( |
| ) |
|
|
protected |
◆ testAccept()
SequentialTest::testAccept |
( |
| ) |
|
Definition at line 25 of file SequentialTest.php.
References array.
27 $constraint = $this->f->sequential(
array($this->f->isInt(), $this->f->greaterThan(3), $this->f->lessThan(5)));
29 $this->assertTrue($constraint->accepts(4));
30 $this->assertFalse($constraint->accepts(2));
Create styles array
The data for the language used.
◆ testCheck()
SequentialTest::testCheck |
( |
| ) |
|
Definition at line 33 of file SequentialTest.php.
References array.
35 $constraint = $this->f->sequential(
array($this->f->isInt(), $this->f->greaterThan(3), $this->f->lessThan(5)));
39 $constraint->check(4);
44 $this->assertFalse($raised);
47 $constraint->check(2);
50 $this->assertEquals(
"'2' is not greater than '3'.", $e->getMessage());
54 $this->assertTrue($raised);
Create styles array
The data for the language used.
◆ testCorrectErrorMessagesAfterMultiAccept()
SequentialTest::testCorrectErrorMessagesAfterMultiAccept |
( |
| ) |
|
Definition at line 94 of file SequentialTest.php.
References array.
96 $constraint = $this->f->sequential(
array($this->f->isInt(), $this->f->greaterThan(3), $this->f->lessThan(2)));
97 $constraint->accepts(
"A");
98 $constraint->accepts(2);
99 $constraint->accepts(4);
101 $this->assertEquals(
"'string' is not an integer.", $constraint->problemWith(
"A"));
102 $this->assertEquals(
"'2' is not greater than '3'.", $constraint->problemWith(2));
103 $this->assertEquals(
"'4' is greater than '2'.", $constraint->problemWith(4));
Create styles array
The data for the language used.
◆ testProblemWith()
SequentialTest::testProblemWith |
( |
| ) |
|
Definition at line 57 of file SequentialTest.php.
References array.
59 $constraint = $this->f->sequential(
array($this->f->isInt(), $this->f->greaterThan(3), $this->f->lessThan(5)));
61 $this->assertNull($constraint->problemWith(4));
62 $this->assertInternalType(
"string", $constraint->problemWith(2));
Create styles array
The data for the language used.
◆ testRestrict()
SequentialTest::testRestrict |
( |
| ) |
|
Definition at line 65 of file SequentialTest.php.
References $error, $ok, $result, and array.
67 $constraint = $this->f->sequential(
array($this->f->isInt(), $this->f->greaterThan(3), $this->f->lessThan(5)));
69 $rf =
new Data\Factory();
72 $error = $rf->error(
"text");
75 $this->assertTrue(
$result->isOk());
77 $result = $constraint->restrict($ok2);
78 $this->assertTrue($result->isError());
80 $result = $constraint->restrict(
$error);
81 $this->assertSame(
$error, $result);
Create styles array
The data for the language used.
◆ testWithProblemBuilder()
SequentialTest::testWithProblemBuilder |
( |
| ) |
|
Definition at line 84 of file SequentialTest.php.
References array.
86 $constraint = $this->f->sequential(
array($this->f->isInt(), $this->f->greaterThan(3), $this->f->lessThan(5)));
88 $new_constraint = $constraint->withProblemBuilder(
function () {
89 return "This was a vault";
91 $this->assertEquals(
"This was a vault", $new_constraint->problemWith(2));
Create styles array
The data for the language used.
The documentation for this class was generated from the following file: