ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLearnerProgressDBTest Class Reference
+ Inheritance diagram for ilLearnerProgressDBTest:
+ Collaboration diagram for ilLearnerProgressDBTest:

Public Member Functions

 testCreateObject ()
 
 testGetLearnerItemsWithoutData ()
 
 testGetLearnerItemsWithNonVisibleLSItem ()
 
 testGetLearnerItemsWithVisibleLSItem ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $items_db
 
 $access
 

Detailed Description

Definition at line 31 of file ilLearnerProgressDBTest.php.

Member Function Documentation

◆ setUp()

ilLearnerProgressDBTest::setUp ( )
protected

Definition at line 43 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

43  : void
44  {
45  $this->items_db = $this->createMock(ilLSItemsDB::class);
46  $this->access = $this->createMock(ilAccess::class);
47  $this->obj_data_cache = $this->createMock(ilObjectDataCache::class);
48  }
+ Here is the call graph for this function:

◆ testCreateObject()

ilLearnerProgressDBTest::testCreateObject ( )

Definition at line 50 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

50  : void
51  {
52  $obj = new ilLearnerProgressDB($this->items_db, $this->access, $this->obj_data_cache);
53 
54  $this->assertInstanceOf(ilLearnerProgressDB::class, $obj);
55  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testGetLearnerItemsWithNonVisibleLSItem()

ilLearnerProgressDBTest::testGetLearnerItemsWithNonVisibleLSItem ( )

Definition at line 73 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

73  : void
74  {
75  $ls_item = $this->createMock(LSItem::class);
76 
77  $ls_item
78  ->expects($this->once())
79  ->method('isOnline')
80  ->willReturn(false)
81  ;
82  $ls_item
83  ->expects($this->once())
84  ->method('getRefId')
85  ->willReturn(33)
86  ;
87 
88  $this->access
89  ->expects($this->once())
90  ->method('checkAccessOfUser')
91  ->with(100, 'visible', '', 33)
92  ->willReturn(false)
93  ;
94 
95  $this->items_db
96  ->expects($this->once())
97  ->method('getLSItems')
98  ->with(44)
99  ->willReturn([$ls_item])
100  ;
101 
102  $obj = new ilLearnerProgressDB($this->items_db, $this->access, $this->obj_data_cache);
103  $result = $obj->getLearnerItems(100, 44);
104 
105  $this->assertIsArray($result);
106  $this->assertEmpty($result);
107  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testGetLearnerItemsWithoutData()

ilLearnerProgressDBTest::testGetLearnerItemsWithoutData ( )

Definition at line 57 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

57  : void
58  {
59  $this->items_db
60  ->expects($this->once())
61  ->method('getLsItems')
62  ->with(33)
63  ->willReturn([])
64  ;
65 
66  $obj = new ilLearnerProgressDB($this->items_db, $this->access, $this->obj_data_cache);
67  $result = $obj->getLearnerItems(100, 33);
68 
69  $this->assertIsArray($result);
70  $this->assertEmpty($result);
71  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testGetLearnerItemsWithVisibleLSItem()

ilLearnerProgressDBTest::testGetLearnerItemsWithVisibleLSItem ( )

Definition at line 109 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

109  : void
110  {
111  $ls_item = $this->createMock(LSItem::class);
112 
113  $ls_item
114  ->expects($this->exactly(2))
115  ->method('isOnline')
116  ->willReturn(true)
117  ;
118  $ls_item
119  ->expects($this->exactly(3))
120  ->method('getRefId')
121  ->willReturn(33)
122  ;
123 
124  $this->access
125  ->expects($this->once())
126  ->method('clear')
127  ;
128  $this->access
129  ->expects($this->exactly(2))
130  ->method('checkAccessOfUser')
131  ->withConsecutive([100, 'visible', '', 33], [100, 'read', '', 33])
132  ->willReturn(true)
133  ;
134 
135  $this->items_db
136  ->expects($this->once())
137  ->method('getLSItems')
138  ->with(44)
139  ->willReturn([$ls_item])
140  ;
141 
142  $obj = new ilLearnerProgressDBStub($this->items_db, $this->access, $this->obj_data_cache);
143  $result = $obj->getLearnerItems(100, 44);
144 
145  foreach ($result as $ls_learner_item) {
146  $this->assertInstanceOf(LSLearnerItem::class, $ls_learner_item);
147  $this->assertEquals(33, $ls_learner_item->getRefId());
148  $this->assertEquals(20, $ls_learner_item->getLearningProgressStatus());
149  $this->assertEquals(1, $ls_learner_item->getAvailability());
150  }
151  }
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilLearnerProgressDBTest::$access
protected

Definition at line 41 of file ilLearnerProgressDBTest.php.

◆ $items_db

ilLearnerProgressDBTest::$items_db
protected

Definition at line 36 of file ilLearnerProgressDBTest.php.


The documentation for this class was generated from the following file: