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->c = $this->f->isNumeric();
22 $this->assertTrue($this->c->accepts(0));
27 $this->assertTrue($this->c->accepts(
"1"));
32 $this->assertTrue($this->c->accepts(1));
37 $this->assertTrue($this->c->accepts(0x102));
42 $this->assertTrue($this->c->accepts(0102));
47 $this->assertTrue($this->c->accepts(0b101));
52 $this->assertTrue($this->c->accepts(192e0));
57 $this->assertTrue($this->c->accepts(9.1));
62 $this->assertFalse($this->c->accepts(null));
67 $this->assertFalse($this->c->accepts(
"foo"));
73 $this->assertTrue(
true);
78 $this->expectException(\UnexpectedValueException::class);
84 $this->assertNull($this->c->problemWith(2));
90 ->expects($this->
once())
95 $this->assertEquals(
"-aa-", $this->c->problemWith(
"aa"));
100 $ok = $this->df->ok(2);
102 $res = $this->c->restrict(
$ok);
103 $this->assertTrue(
$res->isOk());
108 $not_ok = $this->df->ok(
"");
110 $res = $this->c->restrict($not_ok);
111 $this->assertFalse(
$res->isOk());
116 $error = $this->df->error(
"error");
118 $res = $this->c->restrict($error);
119 $this->assertSame($error,
$res);
124 $new_c = $this->c->withProblemBuilder(
function () {
125 return "This was a fault";
127 $this->assertEquals(
"This was a fault", $new_c->problemWith(
""));
foreach($_POST as $key=> $value) $res
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.