ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
r
s
t
w
+
Functions
_
a
b
c
f
g
h
i
r
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
IsNullConstraintTest.php
Go to the documentation of this file.
1
<?php
2
3
/* Copyright (c) 2018 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
require_once(
"libs/composer/vendor/autoload.php"
);
5
6
use
ILIAS\Refinery\Factory
;
7
use
ILIAS\Data
;
8
use
PHPUnit\Framework\TestCase
;
9
10
class
IsNullConstraintTest
extends
TestCase
11
{
12
public
function
setUp
() : void
13
{
14
$this->df =
new
Data\Factory();
15
$this->lng = $this->createMock(\ilLanguage::class);
16
$this->f =
new
Factory
($this->df, $this->lng);
17
18
$this->c = $this->f->null();
19
}
20
21
public
function
testAccepts
()
22
{
23
$this->assertTrue($this->c->accepts(null));
24
}
25
26
public
function
testNotAccepts
()
27
{
28
$this->assertFalse($this->c->accepts(2));
29
}
30
31
public
function
testCheckSucceed
()
32
{
33
$this->c->check(null);
34
$this->assertTrue(
true
);
// does not throw
35
}
36
37
public
function
testCheckFails
()
38
{
39
$this->expectException(\UnexpectedValueException::class);
40
$this->c->check(2);
41
}
42
43
public
function
testNoProblemWith
()
44
{
45
$this->assertNull($this->c->problemWith(null));
46
}
47
48
public
function
testProblemWith
()
49
{
50
$this->lng
51
->expects($this->once())
52
->method(
"txt"
)
53
->with(
"not_a_null"
)
54
->willReturn(
"-%s-"
);
55
56
$this->assertEquals(
"-integer-"
, $this->c->problemWith(2));
57
}
58
59
public
function
testRestrictOk
()
60
{
61
$ok
= $this->df->ok(null);
62
63
$res
= $this->c->applyTo(
$ok
);
64
$this->assertTrue(
$res
->isOk());
65
}
66
67
public
function
testRestrictNotOk
()
68
{
69
$not_ok = $this->df->ok(2);
70
71
$res
= $this->c->applyTo($not_ok);
72
$this->assertFalse(
$res
->isOk());
73
}
74
75
public
function
testRestrictError
()
76
{
77
$error = $this->df->error(
"error"
);
78
79
$res
= $this->c->applyTo($error);
80
$this->assertSame($error,
$res
);
81
}
82
83
public
function
testWithProblemBuilder
()
84
{
85
$new_c = $this->c->withProblemBuilder(
function
() {
86
return
"This was a fault"
;
87
});
88
$this->assertEquals(
"This was a fault"
, $new_c->problemWith(2));
89
}
90
}
IsNullConstraintTest\testWithProblemBuilder
testWithProblemBuilder()
Definition:
IsNullConstraintTest.php:83
IsNullConstraintTest\testCheckSucceed
testCheckSucceed()
Definition:
IsNullConstraintTest.php:31
IsNullConstraintTest\setUp
setUp()
Definition:
IsNullConstraintTest.php:12
IsNullConstraintTest\testRestrictError
testRestrictError()
Definition:
IsNullConstraintTest.php:75
IsNullConstraintTest\testRestrictOk
testRestrictOk()
Definition:
IsNullConstraintTest.php:59
IsNullConstraintTest\testProblemWith
testProblemWith()
Definition:
IsNullConstraintTest.php:48
IsNullConstraintTest\testNotAccepts
testNotAccepts()
Definition:
IsNullConstraintTest.php:26
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
Factory
IsNullConstraintTest\testAccepts
testAccepts()
Definition:
IsNullConstraintTest.php:21
IsNullConstraintTest\testRestrictNotOk
testRestrictNotOk()
Definition:
IsNullConstraintTest.php:67
IsNullConstraintTest
Definition:
IsNullConstraintTest.php:10
ILIAS\Data\Factory
Builds data types.
Definition:
Factory.php:19
$ok
$ok
Definition:
UtfNormalTest.php:80
IsNullConstraintTest\testNoProblemWith
testNoProblemWith()
Definition:
IsNullConstraintTest.php:43
IsNullConstraintTest\testCheckFails
testCheckFails()
Definition:
IsNullConstraintTest.php:37
TestCase
ILIAS\Data
Definition:
Alphanumeric.php:10
tests
Refinery
Null
Constraint
IsNullConstraintTest.php
Generated on Sun Apr 13 2025 21:01:52 for ILIAS by
1.8.13 (using
Doxyfile
)