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