ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ 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
s
t
w
+
Functions
_
a
b
c
f
g
h
i
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
GreaterThanConstraintTest.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
5
namespace
ILIAS\Tests\Refinery\Integer\Constraints
;
6
7
require_once(
"libs/composer/vendor/autoload.php"
);
8
9
use
ILIAS\Data
;
10
use
PHPUnit\Framework\TestCase
;
11
12
class
GreaterThanConstraintTest
extends
TestCase
13
{
17
private
$df
;
18
22
private
$lng
;
23
27
private
$greater_than
;
28
29
public
function
setUp
() : void
30
{
31
$this->df =
new
Data\Factory
();
32
$this->lng = $this->getMockBuilder(\ilLanguage::class)
33
->disableOriginalConstructor()
34
->getMock();
35
36
$this->greater_than = 10;
37
38
$this->c = new \ILIAS\Refinery\Integer\GreaterThan(
39
$this->greater_than,
40
$this->df,
41
$this->lng
42
);
43
}
44
45
public
function
testAccepts
()
46
{
47
$this->assertTrue($this->c->accepts(12));
48
}
49
50
public
function
testNotAccepts
()
51
{
52
$this->assertFalse($this->c->accepts(2));
53
}
54
55
public
function
testCheckSucceed
()
56
{
57
$this->c->check(12);
58
$this->assertTrue(
true
);
// does not throw
59
}
60
61
public
function
testCheckFails
()
62
{
63
$this->expectException(\UnexpectedValueException::class);
64
$this->c->check(2);
65
}
66
67
public
function
testNoProblemWith
()
68
{
69
$this->assertNull($this->c->problemWith(12));
70
}
71
72
public
function
testProblemWith
()
73
{
74
$this->lng
75
->expects($this->once())
76
->method(
"txt"
)
77
->with(
"not_greater_than"
)
78
->willReturn(
"-%s-%s-"
);
79
80
$this->assertEquals(
"-2-10-"
, $this->c->problemWith(2));
81
}
82
83
public
function
testRestrictOk
()
84
{
85
$ok
= $this->df->ok(12);
86
87
$res
= $this->c->applyTo(
$ok
);
88
$this->assertTrue(
$res
->isOk());
89
}
90
91
public
function
testRestrictNotOk
()
92
{
93
$not_ok = $this->df->ok(2);
94
95
$res
= $this->c->applyTo($not_ok);
96
$this->assertFalse(
$res
->isOk());
97
}
98
99
public
function
testRestrictError
()
100
{
101
$error = $this->df->error(
"error"
);
102
103
$res
= $this->c->applyTo($error);
104
$this->assertSame($error,
$res
);
105
}
106
107
public
function
testWithProblemBuilder
()
108
{
109
$new_c = $this->c->withProblemBuilder(
function
() {
110
return
"This was a fault"
;
111
});
112
$this->assertEquals(
"This was a fault"
, $new_c->problemWith(2));
113
}
114
}
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testCheckSucceed
testCheckSucceed()
Definition:
GreaterThanConstraintTest.php:55
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testRestrictNotOk
testRestrictNotOk()
Definition:
GreaterThanConstraintTest.php:91
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testAccepts
testAccepts()
Definition:
GreaterThanConstraintTest.php:45
ILIAS\Tests\Refinery\Integer\Constraints
Definition:
GreaterThanConstraintTest.php:5
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest
Definition:
GreaterThanConstraintTest.php:12
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\setUp
setUp()
Definition:
GreaterThanConstraintTest.php:29
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\$greater_than
$greater_than
Definition:
GreaterThanConstraintTest.php:27
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testWithProblemBuilder
testWithProblemBuilder()
Definition:
GreaterThanConstraintTest.php:107
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testNotAccepts
testNotAccepts()
Definition:
GreaterThanConstraintTest.php:50
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testNoProblemWith
testNoProblemWith()
Definition:
GreaterThanConstraintTest.php:67
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testProblemWith
testProblemWith()
Definition:
GreaterThanConstraintTest.php:72
ILIAS\Data\Factory
Builds data types.
Definition:
Factory.php:19
$ok
$ok
Definition:
UtfNormalTest.php:80
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testRestrictOk
testRestrictOk()
Definition:
GreaterThanConstraintTest.php:83
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\$df
$df
Definition:
GreaterThanConstraintTest.php:17
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testCheckFails
testCheckFails()
Definition:
GreaterThanConstraintTest.php:61
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\testRestrictError
testRestrictError()
Definition:
GreaterThanConstraintTest.php:99
TestCase
ILIAS\Tests\Refinery\Integer\Constraints\GreaterThanConstraintTest\$lng
$lng
Definition:
GreaterThanConstraintTest.php:22
ILIAS\Data
Definition:
Alphanumeric.php:10
tests
Refinery
Integer
Constraints
GreaterThanConstraintTest.php
Generated on Sat Apr 12 2025 20:01:37 for ILIAS by
1.8.13 (using
Doxyfile
)