ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilLearnerProgressDBTest Class Reference
+ Inheritance diagram for ilLearnerProgressDBTest:
+ Collaboration diagram for ilLearnerProgressDBTest:

Public Member Functions

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

Protected Member Functions

 setUp ()
 

Protected Attributes

ilLSItemsDB $items_db
 
ilAccess $access
 
ilObjectDataCache $obj_data_cache
 

Detailed Description

Definition at line 31 of file ilLearnerProgressDBTest.php.

Member Function Documentation

◆ setUp()

ilLearnerProgressDBTest::setUp ( )
protected

Definition at line 37 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

37  : void
38  {
39  $this->items_db = $this->createMock(ilLSItemsDB::class);
40  $this->access = $this->createMock(ilAccess::class);
41  $this->obj_data_cache = $this->createMock(ilObjectDataCache::class);
42  }
+ Here is the call graph for this function:

◆ testCreateObject()

ilLearnerProgressDBTest::testCreateObject ( )

Definition at line 44 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

44  : void
45  {
46  $obj = new ilLearnerProgressDB($this->items_db, $this->access, $this->obj_data_cache);
47 
48  $this->assertInstanceOf(ilLearnerProgressDB::class, $obj);
49  }
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 67 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

67  : void
68  {
69  $ls_item = $this->createMock(LSItem::class);
70 
71  $ls_item
72  ->expects($this->once())
73  ->method('isOnline')
74  ->willReturn(false)
75  ;
76  $ls_item
77  ->expects($this->once())
78  ->method('getRefId')
79  ->willReturn(33)
80  ;
81 
82  $this->access
83  ->expects($this->once())
84  ->method('checkAccessOfUser')
85  ->with(100, 'visible', '', 33)
86  ->willReturn(false)
87  ;
88 
89  $this->items_db
90  ->expects($this->once())
91  ->method('getLSItems')
92  ->with(44)
93  ->willReturn([$ls_item])
94  ;
95 
96  $obj = new ilLearnerProgressDB($this->items_db, $this->access, $this->obj_data_cache);
97  $result = $obj->getLearnerItems(100, 44);
98 
99  $this->assertIsArray($result);
100  $this->assertEmpty($result);
101  }
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 51 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

51  : void
52  {
53  $this->items_db
54  ->expects($this->once())
55  ->method('getLsItems')
56  ->with(33)
57  ->willReturn([])
58  ;
59 
60  $obj = new ilLearnerProgressDB($this->items_db, $this->access, $this->obj_data_cache);
61  $result = $obj->getLearnerItems(100, 33);
62 
63  $this->assertIsArray($result);
64  $this->assertEmpty($result);
65  }
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 103 of file ilLearnerProgressDBTest.php.

References ILIAS\Repository\access().

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

Field Documentation

◆ $access

ilAccess ilLearnerProgressDBTest::$access
protected

Definition at line 34 of file ilLearnerProgressDBTest.php.

◆ $items_db

ilLSItemsDB ilLearnerProgressDBTest::$items_db
protected

Definition at line 33 of file ilLearnerProgressDBTest.php.

◆ $obj_data_cache

ilObjectDataCache ilLearnerProgressDBTest::$obj_data_cache
protected

Definition at line 35 of file ilLearnerProgressDBTest.php.


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