ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
LSLearnerItemTest.php
Go to the documentation of this file.
1
<?
php
2
3
declare(strict_types=1);
4
5
use
PHPUnit\Framework\TestCase
;
6
use
ILIAS\KioskMode\State
;
7
8
class
LSLearnerItemTest
extends
TestCase
9
{
10
const
TYPE
=
"type"
;
11
const
TITLE
=
"tile"
;
12
const
DESC
=
"description"
;
13
const
ICON_PATH
=
"icon_path"
;
14
const
IS_ONLINE
=
true
;
15
const
ORDER_NUMBER
= 10;
16
const
REF_ID
= 30;
17
const
USER_ID
= 6;
18
const
LP_STATUS
= 2;
19
const
AVAILABILITY_STATUS
= 3;
20
24
protected
$post_condition
;
25
26
public
function
setUp
()
27
{
28
$this->post_condition =
new
ilLSPostCondition
(666,
"1"
);
29
}
30
31
public
function
testCreate
() :
LSLearnerItem
32
{
33
$ui_reflection =
new
ReflectionClass
(State::class);
34
$methods = array_map(
35
function
(
$m
) {
36
return
$m
->getName();
37
},
38
$ui_reflection->getMethods()
39
);
40
41
$kiosk_state = $this->getMockBuilder(State::class)
42
->setMethods($methods)
43
->getMock()
44
;
45
46
$ls_item =
new
LSItem
(
47
self::TYPE,
48
self::TITLE,
49
self::DESC,
50
self::ICON_PATH,
51
self::IS_ONLINE,
52
self::ORDER_NUMBER,
53
$this->post_condition,
54
self::REF_ID
55
);
56
57
$object =
new
LSLearnerItem
(
58
self::USER_ID,
59
function
() {
60
return
self::LP_STATUS;
61
},
62
self::AVAILABILITY_STATUS,
63
$kiosk_state,
64
$ls_item
65
);
66
67
$this->assertEquals($object->getUserId(), self::USER_ID);
68
$this->assertEquals($object->getLearningProgressStatus(), self::LP_STATUS);
69
$this->assertEquals($object->getAvailability(), self::AVAILABILITY_STATUS);
70
$this->assertEquals($object->getState(), $kiosk_state);
71
72
return
$object;
73
}
74
78
public
function
testTurnedOffWithPostCondition
(
LSItem
$object)
79
{
80
$this->expectException(LogicException::class);
81
$object->
withPostCondition
($this->post_condition);
82
}
83
87
public
function
testTurnedOffWithOrderNumber
(
LSItem
$object)
88
{
89
$this->expectException(LogicException::class);
90
$object->
withOrderNumber
(self::ORDER_NUMBER);
91
}
92
96
public
function
testTurnedOffWithOnline
(
LSItem
$object)
97
{
98
$this->expectException(LogicException::class);
99
$object->
withOnline
(self::IS_ONLINE);
100
}
101
}
LSLearnerItemTest
Definition:
LSLearnerItemTest.php:8
State
LSLearnerItemTest\ORDER_NUMBER
const ORDER_NUMBER
Definition:
LSLearnerItemTest.php:15
LSLearnerItemTest\IS_ONLINE
const IS_ONLINE
Definition:
LSLearnerItemTest.php:14
LSLearnerItemTest\LP_STATUS
const LP_STATUS
Definition:
LSLearnerItemTest.php:18
LSLearnerItemTest\testTurnedOffWithPostCondition
testTurnedOffWithPostCondition(LSItem $object)
testCreate
Definition:
LSLearnerItemTest.php:78
LSItem\withOrderNumber
withOrderNumber(int $order_number)
Definition:
LSItem.php:110
$m
$m
Definition:
show_metadata.php:25
LSLearnerItemTest\USER_ID
const USER_ID
Definition:
LSLearnerItemTest.php:17
LSItem
Data holding class LSItem .
Definition:
LSItem.php:11
LSLearnerItemTest\AVAILABILITY_STATUS
const AVAILABILITY_STATUS
Definition:
LSLearnerItemTest.php:19
LSLearnerItemTest\TYPE
const TYPE
Definition:
LSLearnerItemTest.php:10
LSLearnerItemTest\DESC
const DESC
Definition:
LSLearnerItemTest.php:12
LSLearnerItemTest\testTurnedOffWithOrderNumber
testTurnedOffWithOrderNumber(LSItem $object)
testCreate
Definition:
LSLearnerItemTest.php:87
LSLearnerItemTest\testTurnedOffWithOnline
testTurnedOffWithOnline(LSItem $object)
testCreate
Definition:
LSLearnerItemTest.php:96
LSLearnerItemTest\$post_condition
$post_condition
Definition:
LSLearnerItemTest.php:24
ilLSPostCondition
A PostCondition does restrict the progression of a user through the learning sequence.
Definition:
class.ilLSPostCondition.php:14
LSItem\withPostCondition
withPostCondition(ilLSPostCondition $postcondition)
Definition:
LSItem.php:122
LSItem\withOnline
withOnline(bool $online)
Definition:
LSItem.php:98
ReflectionClass
LSLearnerItemTest\setUp
setUp()
Definition:
LSLearnerItemTest.php:26
LSLearnerItemTest\testCreate
testCreate()
Definition:
LSLearnerItemTest.php:31
LSLearnerItemTest\ICON_PATH
const ICON_PATH
Definition:
LSLearnerItemTest.php:13
php
LSLearnerItemTest\REF_ID
const REF_ID
Definition:
LSLearnerItemTest.php:16
TestCase
LSLearnerItemTest\TITLE
const TITLE
Definition:
LSLearnerItemTest.php:11
LSLearnerItem
Add learning progress and availability information to the LSItem.
Definition:
LSLearnerItem.php:11
Modules
LearningSequence
test
LearnerProgress
LSLearnerItemTest.php
Generated on Thu Feb 27 2025 19:01:42 for ILIAS by
1.8.13 (using
Doxyfile
)