ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPluginsOverviewTableTest Class Reference
+ Inheritance diagram for ilPluginsOverviewTableTest:
+ Collaboration diagram for ilPluginsOverviewTableTest:

Public Member Functions

 testCreateObject ()
 
 testGetImportantFields (bool $installed, bool $active)
 getImportantFieldData More...
 
 testGetContent ()
 
 testBoolToString ()
 
 testFilterData ()
 
 testGetData ()
 
 testWithData ()
 
 testGetActionsPluginNotInstalled ()
 
 testGetActionsPluginInstalled ()
 

Static Public Member Functions

static getImportantFieldData ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

ilObjComponentSettingsGUI $parent_gui
 
ilCtrl $ctrl
 
Factory $ui
 
Renderer $renderer
 
ilLanguage $lng
 

Detailed Description

Definition at line 29 of file ilPluginsOverviewTableTest.php.

Member Function Documentation

◆ getImportantFieldData()

static ilPluginsOverviewTableTest::getImportantFieldData ( )
static

Definition at line 54 of file ilPluginsOverviewTableTest.php.

54  : array
55  {
56  return [
57  [true, true],
58  [true, false],
59  [false, true],
60  [false, false]
61  ];
62  }

◆ setUp()

ilPluginsOverviewTableTest::setUp ( )
protected

Definition at line 37 of file ilPluginsOverviewTableTest.php.

References $id, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), renderer(), and ILIAS\Repository\ui().

37  : void
38  {
39  $this->parent_gui = $this->createMock(ilObjComponentSettingsGUI::class);
40  $this->ctrl = $this->createMock(ilCtrl::class);
41  $this->ui = $this->createMock(Factory::class);
42  $this->renderer = $this->createMock(Renderer::class);
43  $this->lng = $this->createMock(ilLanguage::class);
44  $this->lng->method("txt")
45  ->willReturnCallback(fn($id) => $id);
46  }
renderer()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ testBoolToString()

ilPluginsOverviewTableTest::testBoolToString ( )

Definition at line 135 of file ilPluginsOverviewTableTest.php.

References $ctrl, $lng, $parent_gui, $renderer, and $ui.

135  : void
136  {
138  public function boolToString(bool $value): string
139  {
140  return parent::boolToString($value);
141  }
142  };
143 
144  $result = $obj->boolToString(true);
145  $this->assertEquals("yes", $result);
146 
147  $result = $obj->boolToString(false);
148  $this->assertEquals("no", $result);
149  }
ilObjComponentSettingsGUI $parent_gui

◆ testCreateObject()

ilPluginsOverviewTableTest::testCreateObject ( )

Definition at line 48 of file ilPluginsOverviewTableTest.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), renderer(), and ILIAS\Repository\ui().

48  : void
49  {
50  $obj = new ilPluginsOverviewTable($this->parent_gui, $this->ctrl, $this->ui, $this->renderer, $this->lng, []);
51  $this->assertInstanceOf(ilPluginsOverviewTable::class, $obj);
52  }
renderer()
+ Here is the call graph for this function:

◆ testFilterData()

ilPluginsOverviewTableTest::testFilterData ( )

Definition at line 151 of file ilPluginsOverviewTableTest.php.

References $ctrl, $data, $lng, $parent_gui, $renderer, $ui, and ILIAS\Repository\filter().

151  : void
152  {
154  public function setFilter(array $filter): void
155  {
156  $this->filter = $filter;
157  }
158 
159  public function filterData(array $data): array
160  {
161  return parent::filterData($data);
162  }
163  };
164 
165  $plugin_slot = $this->createMock(ilPluginSlotInfo::class);
166  $plugin_slot
167  ->method("getName")
168  ->willReturn("Repository")
169  ;
170 
171  $component = $this->createMock(ilComponentInfo::class);
172  $component
173  ->method("getQualifiedName")
174  ->willReturn("QualifiedName")
175  ;
176 
177  $plugin_info = $this->createMock(ilPluginInfo::class);
178  $plugin_info
179  ->method("getName")
180  ->willReturn("TestRepo")
181  ;
182  $plugin_info
183  ->method("getId")
184  ->willReturn("xvw")
185  ;
186  $plugin_info
187  ->method("isActive")
188  ->willReturn(true)
189  ;
190  $plugin_info
191  ->method("getPluginSlot")
192  ->willReturn($plugin_slot)
193  ;
194  $plugin_info
195  ->method("getComponent")
196  ->willReturn($component)
197  ;
198 
199  $obj->setFilter(["plugin_name" => "TestRepo"]);
200  $result = $obj->filterData([$plugin_info]);
201  $this->assertEquals($plugin_info, $result[0]);
202 
203  $obj->setFilter(["plugin_name" => "TestRepoFAIL"]);
204  $result = $obj->filterData([$plugin_info]);
205  $this->assertCount(0, $result);
206 
207  $obj->setFilter(["plugin_id" => "xvw"]);
208  $result = $obj->filterData([$plugin_info]);
209  $this->assertEquals($plugin_info, $result[0]);
210 
211  $obj->setFilter(["plugin_id" => "xvwFAIL"]);
212  $result = $obj->filterData([$plugin_info]);
213  $this->assertCount(0, $result);
214 
215  $obj->setFilter(["plugin_active" => "1"]);
216  $result = $obj->filterData([$plugin_info]);
217  $this->assertEquals($plugin_info, $result[0]);
218 
219  $obj->setFilter(["plugin_active" => "-1"]);
220  $result = $obj->filterData([$plugin_info]);
221  $this->assertCount(0, $result);
222 
223  $obj->setFilter(["slot_name" => ["Repository"]]);
224  $result = $obj->filterData([$plugin_info]);
225  $this->assertEquals($plugin_info, $result[0]);
226 
227  $obj->setFilter(["slot_name" => ["RepositoryFAILQualifiedNameFAIL"]]);
228  $result = $obj->filterData([$plugin_info]);
229  $this->assertCount(0, $result);
230 
231  $obj->setFilter(["component_name" => ["QualifiedName"]]);
232  $result = $obj->filterData([$plugin_info]);
233  $this->assertEquals($plugin_info, $result[0]);
234 
235  $obj->setFilter(["component_name" => ["QualifiedNameFAIL"]]);
236  $result = $obj->filterData([$plugin_info]);
237  $this->assertCount(0, $result);
238  }
ilObjComponentSettingsGUI $parent_gui
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:

◆ testGetActionsPluginInstalled()

ilPluginsOverviewTableTest::testGetActionsPluginInstalled ( )

Definition at line 344 of file ilPluginsOverviewTableTest.php.

References $ctrl, $lng, $parent_gui, XapiProxy\$plugin, $renderer, $ui, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\ui().

344  : void
345  {
346  $shy = $this->createMock(Shy::class);
347 
348  $standard = $this->createMock(Standard::class);
349  $standard
350  ->expects($this->once())
351  ->method("getItems")
352  ->willReturn([$shy])
353  ;
354 
355  $dropdown = $this->createMock(\ILIAS\UI\Component\Dropdown\Factory::class);
356  $dropdown
357  ->expects($this->once())
358  ->method("standard")
359  ->willReturn($standard)
360  ;
361 
362  $this->ui
363  ->expects($this->once())
364  ->method("dropdown")
365  ->willReturn($dropdown)
366  ;
367 
369  protected Shy $shy;
370 
371  public function __construct(
373  ilCtrl $ctrl,
374  Factory $ui,
377  array $filter,
378  Shy $shy
379  ) {
380  parent::__construct($parent_gui, $ctrl, $ui, $renderer, $lng, $filter);
381  $this->shy = $shy;
382  }
383 
384  public function getActions(ilPluginInfo $plugin_info): Dropdown
385  {
386  return parent::getActions($plugin_info);
387  }
388  protected function setParameter(ilPluginInfo $plugin): void
389  {
390  }
391  protected function clearParameter(): void
392  {
393  }
394  protected function hasLang(ilPluginInfo $plugin_info): bool
395  {
396  return false;
397  }
398  protected function getDropdownButton(string $caption, string $command): Shy
399  {
400  return $this->shy;
401  }
402  };
403 
404  $plugin_info = $this->createMock(ilPluginInfo::class);
405  $plugin_info
406  ->expects($this->once())
407  ->method("isInstalled")
408  ->willReturn(true)
409  ;
410  $plugin_info
411  ->expects($this->once())
412  ->method("isActive")
413  ->willReturn(false)
414  ;
415  $plugin_info
416  ->expects($this->once())
417  ->method("isActivationPossible")
418  ->willReturn(false)
419  ;
420  $plugin_info
421  ->expects($this->once())
422  ->method("isUpdateRequired")
423  ->willReturn(false)
424  ;
425 
426  $result = $obj->getActions($plugin_info);
427 
428  $this->assertInstanceOf(Shy::class, $result->getItems()[0]);
429  }
ilObjComponentSettingsGUI $parent_gui
Interface Observer Contains several chained tasks and infos about them.
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:34
This is how the factory for UI elements looks.
Definition: Factory.php:37
Simple value class for information about a plugin.
ilObjComponentSettingsGUI: ilPermissionGUI
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

◆ testGetActionsPluginNotInstalled()

ilPluginsOverviewTableTest::testGetActionsPluginNotInstalled ( )

Definition at line 276 of file ilPluginsOverviewTableTest.php.

References $ctrl, $lng, $parent_gui, XapiProxy\$plugin, $renderer, $ui, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\ui().

276  : void
277  {
278  $shy = $this->createMock(Shy::class);
279 
280  $standard = $this->createMock(Standard::class);
281  $standard
282  ->expects($this->once())
283  ->method("getItems")
284  ->willReturn([$shy])
285  ;
286 
287  $dropdown = $this->createMock(\ILIAS\UI\Component\Dropdown\Factory::class);
288  $dropdown
289  ->expects($this->once())
290  ->method("standard")
291  ->willReturn($standard)
292  ;
293 
294  $this->ui
295  ->expects($this->once())
296  ->method("dropdown")
297  ->willReturn($dropdown)
298  ;
299 
301  protected Shy $shy;
302 
303  public function __construct(
305  ilCtrl $ctrl,
306  Factory $ui,
309  array $filter,
310  Shy $shy
311  ) {
312  parent::__construct($parent_gui, $ctrl, $ui, $renderer, $lng, $filter);
313  $this->shy = $shy;
314  }
315 
316  public function getActions(ilPluginInfo $plugin_info): Dropdown
317  {
318  return parent::getActions($plugin_info);
319  }
320  protected function setParameter(ilPluginInfo $plugin): void
321  {
322  }
323  protected function clearParameter(): void
324  {
325  }
326  protected function getDropdownButton(string $caption, string $command): Shy
327  {
328  return $this->shy;
329  }
330  };
331 
332  $plugin_info = $this->createMock(ilPluginInfo::class);
333  $plugin_info
334  ->expects($this->once())
335  ->method("isInstalled")
336  ->willReturn(false)
337  ;
338 
339  $result = $obj->getActions($plugin_info);
340 
341  $this->assertInstanceOf(Shy::class, $result->getItems()[0]);
342  }
ilObjComponentSettingsGUI $parent_gui
Interface Observer Contains several chained tasks and infos about them.
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:34
This is how the factory for UI elements looks.
Definition: Factory.php:37
Simple value class for information about a plugin.
ilObjComponentSettingsGUI: ilPermissionGUI
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

◆ testGetContent()

ilPluginsOverviewTableTest::testGetContent ( )

Definition at line 104 of file ilPluginsOverviewTableTest.php.

References $ctrl, $lng, $parent_gui, $renderer, $ui, and ILIAS\UI\Implementation\Component\Input\ViewControl\getContent().

104  : void
105  {
107  public function getContent(ilPluginInfo $plugin_info): array
108  {
109  return parent::getContent($plugin_info);
110  }
111  };
112 
113  $plugin_info = $this->createMock(ilPluginInfo::class);
114  $plugin_info
115  ->expects($this->once())
116  ->method("isInstalled")
117  ->willReturn(true)
118  ;
119  $plugin_info
120  ->expects($this->once())
121  ->method("isActive")
122  ->willReturn(true)
123  ;
124  $plugin_info
125  ->expects($this->once())
126  ->method("isUpdateRequired")
127  ->willReturn(true)
128  ;
129 
130  $result = $obj->getContent($plugin_info);
131 
132  $this->assertIsArray($result);
133  }
ilObjComponentSettingsGUI $parent_gui
Simple value class for information about a plugin.
+ Here is the call graph for this function:

◆ testGetData()

ilPluginsOverviewTableTest::testGetData ( )

Definition at line 240 of file ilPluginsOverviewTableTest.php.

References $ctrl, $lng, $parent_gui, $renderer, and $ui.

240  : void
241  {
243  public function getData(): array
244  {
245  return parent::getData();
246  }
247  };
248 
249  $result = $obj->getData();
250 
251  $this->assertIsArray($result);
252  $this->assertEmpty($result);
253  }
ilObjComponentSettingsGUI $parent_gui

◆ testGetImportantFields()

ilPluginsOverviewTableTest::testGetImportantFields ( bool  $installed,
bool  $active 
)

getImportantFieldData

Definition at line 67 of file ilPluginsOverviewTableTest.php.

References $ctrl, $lng, $parent_gui, $renderer, and $ui.

67  : void
68  {
70  public function getImportantFields(ilPluginInfo $plugin_info): array
71  {
72  return parent::getImportantFields($plugin_info);
73  }
74  };
75 
76  $plugin_info = $this->createMock(ilPluginInfo::class);
77  $plugin_info
78  ->expects($this->once())
79  ->method("isInstalled")
80  ->willReturn($installed)
81  ;
82  $plugin_info
83  ->expects($this->once())
84  ->method("isActive")
85  ->willReturn($active)
86  ;
87 
88  $result1 = "not_installed";
89  if ($installed) {
90  $result1 = "installed";
91  }
92 
93  $result2 = "inactive";
94  if ($active) {
95  $result2 = "cmps_active";
96  }
97 
98  $result = $obj->getImportantFields($plugin_info);
99 
100  $this->assertEquals($result1, $result[0]);
101  $this->assertEquals($result2, $result[1]);
102  }
ilObjComponentSettingsGUI $parent_gui
Simple value class for information about a plugin.

◆ testWithData()

ilPluginsOverviewTableTest::testWithData ( )

Definition at line 255 of file ilPluginsOverviewTableTest.php.

References $ctrl, $data, $lng, $parent_gui, $renderer, and $ui.

255  : void
256  {
258  public function getData(): array
259  {
260  return parent::getData();
261  }
262  public function withDataWrapper(array $data)
263  {
264  return parent::withData($data);
265  }
266  };
267 
268  $obj = $obj->withDataWrapper(["data1", "data2"]);
269  $result = $obj->getData();
270 
271  $this->assertIsArray($result);
272  $this->assertEquals("data1", $result[0]);
273  $this->assertEquals("data2", $result[1]);
274  }
ilObjComponentSettingsGUI $parent_gui

Field Documentation

◆ $ctrl

◆ $lng

◆ $parent_gui

◆ $renderer

◆ $ui


The documentation for this class was generated from the following file: