104 : void
105 {
106 $value = [
107 '22' => [
108 'child' => 14,
109 'obj_id' => 16,
110 'type' => 'lsitem',
111 'title' => 'ls_title',
112 'description' => 'tiny_description'
113 ]
114 ];
115
116 $this->tree
117 ->expects($this->once())
118 ->method('getChilds')
119 ->with(22)
120 ->willReturn($value)
121 ;
122
123 $this->sorting_settings
124 ->expects($this->once())
125 ->method('setSortMode')
127 ;
128
129 $this->container_sorting
130 ->expects($this->once())
131 ->method('getSortingSettings')
132 ->willReturn($this->sorting_settings)
133 ;
134 $this->container_sorting
135 ->expects($this->once())
136 ->method('sortItems')
137 ->with(['lsitems' => $value])
138 ->willReturn(['lsitems' => $value])
139 ;
140
141 $condition = $this->createMock(ilLSPostCondition::class);
142 $condition
143 ->expects($this->once())
144 ->method('getRefId')
145 ->willReturn(14)
146 ;
147
148 $this->post_conditions_db
149 ->expects($this->once())
150 ->method('select')
151 ->with([22 => 14])
152 ->willReturn(['14' => $condition])
153 ;
154
155 $this->ls_item_online_status
156 ->expects($this->once())
157 ->method('getOnlineStatus')
158 ->with(14)
159 ->willReturn(true)
160 ;
161
163 $this->tree,
164 $this->container_sorting,
165 $this->post_conditions_db,
166 $this->ls_item_online_status
167 );
168
169 $result = $obj->getLSItems(22);
170
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());
180 }
181 }