TestCase for the factory of constraints.
More...
◆ setUp()
ValidationFactoryTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 21 of file ValidationFactoryTest.php.
22 {
23 $this->lng = $this->createMock(\ilLanguage::class);
24 $this->f =
new Validation\Factory(
new Data\
Factory(), $this->lng);
25 }
◆ tearDown()
ValidationFactoryTest::tearDown |
( |
| ) |
|
|
protected |
◆ testCustom()
ValidationFactoryTest::testCustom |
( |
| ) |
|
Definition at line 62 of file ValidationFactoryTest.php.
63 {
64 $custom = $this->f->custom(function ($value) {
65 return "This was fault";
66 }, 5);
67 $this->assertInstanceOf(Validation\Constraint::class, $custom);
68 }
◆ testGreaterThan()
ValidationFactoryTest::testGreaterThan |
( |
| ) |
|
Definition at line 44 of file ValidationFactoryTest.php.
45 {
46 $gt = $this->f->greaterThan(5);
47 $this->assertInstanceOf(Validation\Constraint::class, $gt);
48 }
◆ testHasMinLength()
ValidationFactoryTest::testHasMinLength |
( |
| ) |
|
Definition at line 56 of file ValidationFactoryTest.php.
57 {
58 $min = $this->f->hasMinLength(1);
59 $this->assertInstanceOf(Validation\Constraint::class, $min);
60 }
◆ testIsInt()
ValidationFactoryTest::testIsInt |
( |
| ) |
|
Definition at line 32 of file ValidationFactoryTest.php.
33 {
34 $is_numeric = $this->f->isNumeric();
35 $this->assertInstanceOf(Validation\Constraint::class, $is_numeric);
36 }
◆ testIsNumeric()
ValidationFactoryTest::testIsNumeric |
( |
| ) |
|
Definition at line 38 of file ValidationFactoryTest.php.
39 {
40 $is_int = $this->f->isInt();
41 $this->assertInstanceOf(Validation\Constraint::class, $is_int);
42 }
◆ testLessThan()
ValidationFactoryTest::testLessThan |
( |
| ) |
|
Definition at line 50 of file ValidationFactoryTest.php.
51 {
52 $lt = $this->f->lessThan(5);
53 $this->assertInstanceOf(Validation\Constraint::class, $lt);
54 }
◆ testLoadsLanguageModule()
ValidationFactoryTest::testLoadsLanguageModule |
( |
| ) |
|
Definition at line 99 of file ValidationFactoryTest.php.
100 {
101 $lng = $this->createMock(\ilLanguage::class);
102
104 ->expects($this->
once())
105 ->method("loadLanguageModule")
106 ->with(Validation\Factory::LANGUAGE_MODULE);
107
109 }
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
References $lng, and Sabre\Event\once().
◆ testNot()
ValidationFactoryTest::testNot |
( |
| ) |
|
Definition at line 92 of file ValidationFactoryTest.php.
93 {
94 $constraint = $this->f->greaterThan(5);
95 $not = $this->f->not($constraint);
96 $this->assertInstanceOf(Validation\Constraint::class, $not);
97 }
◆ testParallel()
ValidationFactoryTest::testParallel |
( |
| ) |
|
Definition at line 81 of file ValidationFactoryTest.php.
82 {
83 $constraints = array(
84 $this->f->greaterThan(5),
85 $this->f->lessThan(15)
86 );
87
88 $parallel = $this->f->parallel($constraints);
89 $this->assertInstanceOf(Validation\Constraint::class, $parallel);
90 }
◆ testSequential()
ValidationFactoryTest::testSequential |
( |
| ) |
|
Definition at line 70 of file ValidationFactoryTest.php.
71 {
72 $constraints = array(
73 $this->f->greaterThan(5),
74 $this->f->lessThan(15)
75 );
76
77 $sequential = $this->f->sequential($constraints);
78 $this->assertInstanceOf(Validation\Constraint::class, $sequential);
79 }
◆ $f
ValidationFactoryTest::$f = null |
|
protected |
The documentation for this class was generated from the following file: