3 declare(strict_types=1);
27 return './image/tester/myimage.png';
39 protected function setUp(): void
41 $this->tree = $this->createMock(ilTree::class);
42 $this->container_sorting = $this->createMock(ilContainerSorting::class);
43 $this->post_conditions_db = $this->createMock(ilLSPostConditionDB::class);
44 $this->ls_item_online_status = $this->createMock(LSItemOnlineStatus::class);
45 $this->sorting_settings = $this->createMock(ilContainerSortingSettings::class);
52 $this->container_sorting,
53 $this->post_conditions_db,
54 $this->ls_item_online_status
57 $this->assertInstanceOf(ilLSItemsDB::class, $obj);
63 ->expects($this->once())
69 $this->sorting_settings
70 ->expects($this->once())
71 ->method(
'setSortMode')
75 $this->container_sorting
76 ->expects($this->once())
77 ->method(
'getSortingSettings')
78 ->willReturn($this->sorting_settings)
80 $this->container_sorting
81 ->expects($this->once())
83 ->with([
'lsitems' => []])
84 ->willReturn([
'lsitems' => []])
89 $this->container_sorting,
90 $this->post_conditions_db,
91 $this->ls_item_online_status
94 $result = $obj->getLSItems(22);
96 $this->assertIsArray($result);
97 $this->assertEmpty($result);
106 'title' =>
'ls_title',
107 'description' =>
'tiny_description' 112 ->expects($this->once())
113 ->method(
'getChilds')
118 $this->sorting_settings
119 ->expects($this->once())
120 ->method(
'setSortMode')
124 $this->container_sorting
125 ->expects($this->once())
126 ->method(
'getSortingSettings')
127 ->willReturn($this->sorting_settings)
129 $this->container_sorting
130 ->expects($this->once())
131 ->method(
'sortItems')
132 ->with([
'lsitems' => $value])
133 ->willReturn([
'lsitems' => $value])
136 $condition = $this->createMock(ilLSPostCondition::class);
138 ->expects($this->once())
143 $this->post_conditions_db
144 ->expects($this->once())
147 ->willReturn([
'14' => $condition])
150 $this->ls_item_online_status
151 ->expects($this->once())
152 ->method(
'getOnlineStatus')
159 $this->container_sorting,
160 $this->post_conditions_db,
161 $this->ls_item_online_status
164 $result = $obj->getLSItems(22);
166 foreach ($result as $ls_item) {
167 $this->assertEquals(
'lsitem', $ls_item->getType());
168 $this->assertEquals(
'ls_title', $ls_item->getTitle());
169 $this->assertEquals(
'tiny_description', $ls_item->getDescription());
170 $this->assertEquals(
'./image/tester/myimage.png', $ls_item->getIconPath());
171 $this->assertTrue($ls_item->isOnline());
172 $this->assertEquals(22, $ls_item->getOrderNumber());
173 $this->assertInstanceOf(ilLSPostCondition::class, $ls_item->getPostCondition());
174 $this->assertEquals(14, $ls_item->getRefId());
180 $condition = $this->createMock(ilLSPostCondition::class);
193 $this->ls_item_online_status
194 ->expects($this->once())
195 ->method(
'setOnlineStatus')
199 $this->container_sorting
200 ->expects($this->once())
205 $this->post_conditions_db
206 ->expects($this->once())
213 $this->container_sorting,
214 $this->post_conditions_db,
215 $this->ls_item_online_status
218 $obj->storeItems([$ls_item]);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilContainerSortingSettings $sorting_settings
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilContainerSorting $container_sorting
ilLSPostConditionDB $post_conditions_db
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getIconPathForType(string $type)
testGetLSItemsWithoutData()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
LSItemOnlineStatus $ls_item_online_status