3 declare(strict_types=1);
37 protected function setUp(): void
39 $this->items_db = $this->createMock(ilLSItemsDB::class);
40 $this->
access = $this->createMock(ilAccess::class);
41 $this->obj_data_cache = $this->createMock(ilObjectDataCache::class);
48 $this->assertInstanceOf(ilLearnerProgressDB::class, $obj);
54 ->expects($this->once())
55 ->method(
'getLsItems')
61 $result = $obj->getLearnerItems(100, 33);
63 $this->assertIsArray($result);
64 $this->assertEmpty($result);
69 $ls_item = $this->createMock(LSItem::class);
72 ->expects($this->once())
77 ->expects($this->once())
83 ->expects($this->once())
84 ->method(
'checkAccessOfUser')
85 ->with(100,
'visible',
'', 33)
90 ->expects($this->once())
91 ->method(
'getLSItems')
93 ->willReturn([$ls_item])
97 $result = $obj->getLearnerItems(100, 44);
99 $this->assertIsArray($result);
100 $this->assertEmpty($result);
105 $ls_item = $this->createMock(LSItem::class);
108 ->expects($this->exactly(2))
113 ->expects($this->exactly(3))
119 ->expects($this->once())
123 ->expects($this->exactly(2))
124 ->method(
'checkAccessOfUser')
125 ->withConsecutive([100,
'visible',
'', 33], [100,
'read',
'', 33])
130 ->expects($this->once())
131 ->method(
'getLSItems')
133 ->willReturn([$ls_item])
137 $result = $obj->getLearnerItems(100, 44);
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());
testGetLearnerItemsWithNonVisibleLSItem()
testGetLearnerItemsWithoutData()
ilObjectDataCache $obj_data_cache
testGetLearnerItemsWithVisibleLSItem()
Data holding class LSItem .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLearningProgressFor(int $usr_id, LSItem $ls_item)