4 require_once(
"libs/composer/vendor/autoload.php");
13 $this->df =
new Data\Factory();
14 $this->lng = $this->createMock(\ilLanguage::class);
15 $this->f =
new Validation\Factory($this->df, $this->lng);
17 $this->not_true = $this->f->not($this->f->custom(
24 $this->not_false = $this->f->not($this->f->custom(
34 $this->assertTrue($this->not_false->accepts(null));
39 $this->assertFalse($this->not_true->accepts(null));
44 $this->not_false->check(null);
45 $this->assertTrue(
true);
50 $this->expectException(\UnexpectedValueException::class);
51 $this->not_true->check(null);
56 $this->assertNull($this->not_false->problemWith(null));
62 ->expects($this->
once())
67 $this->assertEquals(
"-not_true-", $this->not_true->problemWith(null));
72 $ok = $this->df->ok(null);
74 $res = $this->not_false->restrict(
$ok);
75 $this->assertTrue(
$res->isOk());
80 $not_ok = $this->df->ok(null);
82 $res = $this->not_true->restrict($not_ok);
83 $this->assertFalse(
$res->isOk());
88 $error = $this->df->error(
"error");
90 $res = $this->not_false->restrict($error);
91 $this->assertSame($error,
$res);
96 $new_c = $this->not_true->withProblemBuilder(
function () {
97 return "This was a fault";
99 $this->assertEquals(
"This was a fault", $new_c->problemWith(null));
foreach($_POST as $key=> $value) $res
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.