4 require_once(
"libs/composer/vendor/autoload.php");
23 $this->lng = $this->createMock(\ilLanguage::class);
24 $this->f =
new Validation\Factory(
new Data\
Factory(), $this->lng);
34 $is_numeric = $this->f->isNumeric();
35 $this->assertInstanceOf(Validation\Constraint::class, $is_numeric);
40 $is_int = $this->f->isInt();
41 $this->assertInstanceOf(Validation\Constraint::class, $is_int);
46 $gt = $this->f->greaterThan(5);
47 $this->assertInstanceOf(Validation\Constraint::class, $gt);
52 $lt = $this->f->lessThan(5);
53 $this->assertInstanceOf(Validation\Constraint::class, $lt);
58 $min = $this->f->hasMinLength(1);
59 $this->assertInstanceOf(Validation\Constraint::class, $min);
64 $custom = $this->f->custom(
function ($value) {
65 return "This was fault";
67 $this->assertInstanceOf(Validation\Constraint::class, $custom);
73 $this->f->greaterThan(5),
74 $this->f->lessThan(15)
77 $sequential = $this->f->sequential($constraints);
78 $this->assertInstanceOf(Validation\Constraint::class, $sequential);
84 $this->f->greaterThan(5),
85 $this->f->lessThan(15)
88 $parallel = $this->f->parallel($constraints);
89 $this->assertInstanceOf(Validation\Constraint::class, $parallel);
94 $constraint = $this->f->greaterThan(5);
95 $not = $this->f->not($constraint);
96 $this->assertInstanceOf(Validation\Constraint::class, $not);
101 $lng = $this->createMock(\ilLanguage::class);
104 ->expects($this->
once())
105 ->method(
"loadLanguageModule")
106 ->with(Validation\Factory::LANGUAGE_MODULE);
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
testLoadsLanguageModule()
TestCase for the factory of constraints.