19 declare(strict_types=1);
27 return './image/tester/myimage.png';
43 protected function setUp(): void
45 $this->tree = $this->createMock(ilTree::class);
46 $this->container_sorting = $this->createMock(ilContainerSorting::class);
47 $this->post_conditions_db = $this->createMock(ilLSPostConditionDB::class);
48 $this->ls_item_online_status = $this->createMock(LSItemOnlineStatus::class);
49 $this->sorting_settings = $this->createMock(ilContainerSortingSettings::class);
56 $this->container_sorting,
57 $this->post_conditions_db,
58 $this->ls_item_online_status
61 $this->assertInstanceOf(ilLSItemsDB::class, $obj);
67 ->expects($this->once())
73 $this->sorting_settings
74 ->expects($this->once())
75 ->method(
'setSortMode')
79 $this->container_sorting
80 ->expects($this->once())
81 ->method(
'getSortingSettings')
82 ->willReturn($this->sorting_settings)
84 $this->container_sorting
85 ->expects($this->once())
87 ->with([
'lsitems' => []])
88 ->willReturn([
'lsitems' => []])
93 $this->container_sorting,
94 $this->post_conditions_db,
95 $this->ls_item_online_status
98 $result = $obj->getLSItems(22);
100 $this->assertIsArray($result);
101 $this->assertEmpty($result);
111 'title' =>
'ls_title',
112 'description' =>
'tiny_description' 117 ->expects($this->once())
118 ->method(
'getChilds')
123 $this->sorting_settings
124 ->expects($this->once())
125 ->method(
'setSortMode')
129 $this->container_sorting
130 ->expects($this->once())
131 ->method(
'getSortingSettings')
132 ->willReturn($this->sorting_settings)
134 $this->container_sorting
135 ->expects($this->once())
136 ->method(
'sortItems')
137 ->with([
'lsitems' => $value])
138 ->willReturn([
'lsitems' => $value])
141 $condition = $this->createMock(ilLSPostCondition::class);
143 ->expects($this->once())
148 $this->post_conditions_db
149 ->expects($this->once())
152 ->willReturn([
'14' => $condition])
155 $this->ls_item_online_status
156 ->expects($this->once())
157 ->method(
'getOnlineStatus')
164 $this->container_sorting,
165 $this->post_conditions_db,
166 $this->ls_item_online_status
169 $result = $obj->getLSItems(22);
171 foreach ($result as $ls_item) {
172 $this->assertEquals(
'lsitem', $ls_item->getType());
173 $this->assertEquals(
'ls_title', $ls_item->getTitle());
174 $this->assertEquals(
'tiny_description', $ls_item->getDescription());
175 $this->assertEquals(
'./image/tester/myimage.png', $ls_item->getIconPath());
176 $this->assertTrue($ls_item->isOnline());
177 $this->assertEquals(22, $ls_item->getOrderNumber());
178 $this->assertInstanceOf(ilLSPostCondition::class, $ls_item->getPostCondition());
179 $this->assertEquals(14, $ls_item->getRefId());
185 $condition = $this->createMock(ilLSPostCondition::class);
199 $this->ls_item_online_status
200 ->expects($this->once())
201 ->method(
'setOnlineStatus')
205 $this->container_sorting
206 ->expects($this->once())
211 $this->post_conditions_db
212 ->expects($this->once())
219 $this->container_sorting,
220 $this->post_conditions_db,
221 $this->ls_item_online_status
224 $obj->storeItems([$ls_item]);
Storage for ilLSPostConditions.
ilContainerSortingSettings $sorting_settings
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...
Data holding class LSItem .
getIconPathForType(string $type)
testGetLSItemsWithoutData()
getCurrentLPMode(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
LSItemOnlineStatus $ls_item_online_status