ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilPluginInfoTest Class Reference
+ Inheritance diagram for ilPluginInfoTest:
+ Collaboration diagram for ilPluginInfoTest:

Public Member Functions

 testGetter ()
 
 testIsInstalled ()
 
 testIsNotInstalled ()
 
 testUpdateIsNotRequired ()
 
 testUpdateIsNotRequiredNotInstalled ()
 
 testUpdateIsRequired ()
 
 testIsVersionOld ()
 
 testIsCompliantToILIAS (Data\Version $version, bool $is_compliant)
 versionCompliance More...
 
 testGetPath ()
 
 testGetClassName ()
 
 testGetConfigureClassName ()
 
 testIsActivationPossible (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_version_to_old, bool $is_activation_possible)
 isActivationPossibleTruthTable More...
 
 testIsActive (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_activated, bool $is_version_to_old, bool $is_activation_possible)
 isActiveTruthTable More...
 
 testGetReasonForInactivity (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_activated, bool $is_version_to_old, string $inactivity_reason)
 inactivityReasonTable More...
 
 testGetReasonForInactivityThrowsOnActivePlugin ()
 

Static Public Member Functions

static versionCompliance ()
 
static isActivationPossibleTruthTable ()
 
static isActiveTruthTable ()
 
static inactivityReasonTable ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

Data Factory $data_factory = null
 
ilComponentInfo $component = null
 
ilPluginSlotInfo $pluginslot = null
 
ilPluginInfo $plugin = null
 

Detailed Description

Definition at line 23 of file ilPluginInfoTest.php.

Member Function Documentation

◆ inactivityReasonTable()

static ilPluginInfoTest::inactivityReasonTable ( )
static

Definition at line 539 of file ilPluginInfoTest.php.

539  : array
540  {
541  // is_installed, supports_current_ilias, needs_update, is_activated, is_version_to_old => inactivity_reason
542  return [
543  [false, false, false, false, false, "cmps_needs_matching_ilias_version"],
544  [false, false, false, true, false, "cmps_needs_matching_ilias_version"],
545  [false, false, true , false, false, "cmps_needs_matching_ilias_version"],
546  [false, false, true , true, false, "cmps_needs_matching_ilias_version"],
547  [false, true, false, false, false, "cmps_must_installed"],
548  [false, true, false, true, false, "cmps_must_installed"],
549  [false, true, true , false, false, "cmps_must_installed"],
550  [false, true, true , true, false, "cmps_must_installed"],
551  [true, false, false, false, false, "cmps_needs_matching_ilias_version"],
552  [true, false, false, true, false, "cmps_needs_matching_ilias_version"],
553  [true, false, true , false, false, "cmps_needs_matching_ilias_version"],
554  [true, false, true , true, false, "cmps_needs_matching_ilias_version"],
555  [true, true, false, false, false, "cmps_not_activated"],
556  [true, true, true , false, false, "cmps_needs_update"],
557  [true, true, true , true, false, "cmps_needs_update"],
558  [false, false, false, false, true, "cmps_needs_matching_ilias_version"],
559  [false, false, false, true, true, "cmps_needs_matching_ilias_version"],
560  [false, false, true , false, true, "cmps_needs_matching_ilias_version"],
561  [false, false, true , true, true, "cmps_needs_matching_ilias_version"],
562  [false, true, false, false, true, "cmps_must_installed"],
563  [false, true, false, true, true, "cmps_must_installed"],
564  [false, true, true , false, true, "cmps_must_installed"],
565  [false, true, true , true, true, "cmps_must_installed"],
566  [true, false, false, false, true, "cmps_needs_matching_ilias_version"],
567  [true, false, false, true, true, "cmps_needs_matching_ilias_version"],
568  [true, false, true , false, true, "cmps_needs_matching_ilias_version"],
569  [true, false, true , true, true, "cmps_needs_matching_ilias_version"],
570  [true, true, false, false, true, "cmps_needs_upgrade"],
571  [true, true, true , false, true, "cmps_needs_upgrade"],
572  [true, true, true , true, true, "cmps_needs_upgrade"],
573  ];
574  }

◆ isActivationPossibleTruthTable()

static ilPluginInfoTest::isActivationPossibleTruthTable ( )
static

Definition at line 330 of file ilPluginInfoTest.php.

330  : array
331  {
332  // is_installed, supports_current_ilias, needs_update, is_version_to_old => is_activation_possible
333  return [
334  [false, false, false, false, false],
335  [false, false, true, false, false],
336  [false, true, false, false, false],
337  [false, true, true, false, false],
338  [true, false, false, false, false],
339  [true, false, true, false, false],
340  [true, true, false, false, true],
341  [true, true, true, true, false],
342  [false, false, false, true, false],
343  [false, false, true, true, false],
344  [false, true, false, true, false],
345  [false, true, true, true, false],
346  [true, false, false, true, false],
347  [true, false, true, true, false],
348  [true, true, false, true, false],
349  [true, true, true, true, false]
350  ];
351  }

◆ isActiveTruthTable()

static ilPluginInfoTest::isActiveTruthTable ( )
static

Definition at line 414 of file ilPluginInfoTest.php.

414  : array
415  {
416  // is_installed, supports_current_ilias, needs_update, is_activated, is_version_to_old => is_active
417  return [
418  [false, false, false, false, false, false],
419  [false, false, false, true, false, false],
420  [false, false, true , false, false, false],
421  [false, false, true , true, false, false],
422  [false, true, false, false, false, false],
423  [false, true, false, true, false, false],
424  [false, true, true , false, false, false],
425  [false, true, true , true, false, false],
426  [true, false, false, false, false, false],
427  [true, false, false, true, false, false],
428  [true, false, true , false, false, false],
429  [true, false, true , true, false, false],
430  [true, true, false, false, false, false],
431  [true, true, false, true, false, true],
432  [true, true, true , false, false, false],
433  [true, true, true , true, false, false],
434 
435  [false, false, false, false, true, false],
436  [false, false, false, true, true, false],
437  [false, false, true , false, true, false],
438  [false, false, true , true, true, false],
439  [false, true, false, false, true, false],
440  [false, true, false, true, true, false],
441  [false, true, true , false, true, false],
442  [false, true, true , true, true, false],
443  [true, false, false, false, true, false],
444  [true, false, false, true, true, false],
445  [true, false, true , false, true, false],
446  [true, false, true , true, true, false],
447  [true, true, false, false, true, false],
448  [true, true, false, true, true, false],
449  [true, true, true , false, true, false],
450  [true, true, true , true, true, false],
451  ];
452  }

◆ setUp()

ilPluginInfoTest::setUp ( )
protected

Definition at line 30 of file ilPluginInfoTest.php.

References $pluginslot.

30  : void
31  {
32  $this->data_factory = new Data\Factory();
33 
34  $slots = [];
35  $this->component = new ilComponentInfo(
36  "mod1",
37  "components/ILIAS",
38  "Module1",
39  $slots
40  );
41 
42  $plugins = [];
43  $this->pluginslot = new ilPluginSlotInfo(
44  $this->component,
45  "slt1",
46  "Slot1",
47  $plugins
48  );
49  $slots[] = $this->pluginslot;
50 
51  $this->plugin = new ilPluginInfo(
52  $this->data_factory->version("6.5"),
54  "plg1",
55  "Plugin1",
56  "Type1",
57  true,
58  $this->data_factory->version("1.0.0"),
59  12,
60  $this->data_factory->version("1.0.0"),
61  $this->data_factory->version("6.0"),
62  $this->data_factory->version("6.99"),
63  "Richard Klees",
64  "richard.klees@concepts-and-training.de",
65  true,
66  false,
67  true
68  );
69  }
Simple value class for basic information about a pluginslot.
Simple value class for information about a plugin.
ilPluginSlotInfo $pluginslot
Simple value class for basic information about a component.

◆ testGetClassName()

ilPluginInfoTest::testGetClassName ( )

Definition at line 262 of file ilPluginInfoTest.php.

262  : void
263  {
264  $this->assertEquals(
265  "ilPlugin1Plugin",
266  $this->plugin->getClassName()
267  );
268  }

◆ testGetConfigureClassName()

ilPluginInfoTest::testGetConfigureClassName ( )

Definition at line 270 of file ilPluginInfoTest.php.

270  : void
271  {
272  $this->assertEquals(
273  "ilPlugin1ConfigGUI",
274  $this->plugin->getConfigGUIClassName()
275  );
276  }

◆ testGetPath()

ilPluginInfoTest::testGetPath ( )

Definition at line 254 of file ilPluginInfoTest.php.

References ilComponentRepository\PLUGIN_BASE_PATH.

254  : void
255  {
256  $this->assertEquals(
257  ilComponentRepository::PLUGIN_BASE_PATH . "/Type1/Module1/Slot1/Plugin1",
258  $this->plugin->getPath()
259  );
260  }

◆ testGetReasonForInactivity()

ilPluginInfoTest::testGetReasonForInactivity ( bool  $is_installed,
bool  $supports_current_ilias,
bool  $needs_update,
bool  $is_activated,
bool  $is_version_to_old,
string  $inactivity_reason 
)

inactivityReasonTable

Definition at line 458 of file ilPluginInfoTest.php.

References ILIAS\GlobalScreen\Provider\__construct(), and ilPluginInfo\getReasonForInactivity().

465  : void {
466  $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_activated, $is_version_to_old) extends ilPluginInfo {
467  protected bool $is_installed;
468  protected bool $supports_current_ilias;
469  protected bool $needs_update;
470  protected bool $is_activated;
471  protected bool $is_version_to_old;
472 
473  public function __construct(
474  bool $is_installed,
475  bool $supports_current_ilias,
476  bool $needs_update,
477  bool $is_activated,
478  bool $is_version_to_old
479  ) {
480  $this->is_installed = $is_installed;
481  $this->supports_current_ilias = $supports_current_ilias;
482  $this->needs_update = $needs_update;
483  $this->is_activated = $is_activated;
484  $this->is_version_to_old = $is_version_to_old;
485  }
486 
487  public function isActivated(): bool
488  {
489  return $this->is_activated;
490  }
491 
492  public function isInstalled(): bool
493  {
494  return $this->is_installed;
495  }
496 
497  public function isUpdateRequired(): bool
498  {
499  return $this->needs_update;
500  }
501 
502  public function isCompliantToILIAS(): bool
503  {
504  return $this->supports_current_ilias;
505  }
506 
507  public function getCurrentVersion(): ?Data\Version
508  {
509  return $this->current_version;
510  }
511 
512  public function isVersionToOld(): bool
513  {
514  return $this->is_version_to_old;
515  }
516  };
517 
518  $this->assertEquals($inactivity_reason, $plugin->getReasonForInactivity());
519  }
ilPluginInfo $plugin
Simple value class for information about a plugin.
getReasonForInactivity()
Which is the reason for the inactivity?
__construct(Container $dic, ilPlugin $plugin)
A version number that consists of three numbers (major, minor, patch).
Definition: Version.php:26
+ Here is the call graph for this function:

◆ testGetReasonForInactivityThrowsOnActivePlugin()

ilPluginInfoTest::testGetReasonForInactivityThrowsOnActivePlugin ( )

Definition at line 521 of file ilPluginInfoTest.php.

References ILIAS\GlobalScreen\Provider\__construct(), and ilPluginInfo\getReasonForInactivity().

521  : void
522  {
523  $this->expectException(LogicException::class);
524 
525  $plugin = new class () extends ilPluginInfo {
526  public function __construct()
527  {
528  }
529 
530  public function isActive(): bool
531  {
532  return true;
533  }
534  };
535 
537  }
ilPluginInfo $plugin
Simple value class for information about a plugin.
getReasonForInactivity()
Which is the reason for the inactivity?
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

◆ testGetter()

ilPluginInfoTest::testGetter ( )

Definition at line 71 of file ilPluginInfoTest.php.

71  : void
72  {
73  $this->assertEquals($this->pluginslot, $this->plugin->getPluginSlot());
74  $this->assertEquals($this->component, $this->plugin->getComponent());
75  $this->assertEquals("plg1", $this->plugin->getId());
76  $this->assertEquals("Plugin1", $this->plugin->getName());
77  $this->assertEquals("Type1", $this->plugin->getType());
78  $this->assertTrue($this->plugin->isActivated());
79  $this->assertEquals($this->data_factory->version("1.0.0"), $this->plugin->getCurrentVersion());
80  $this->assertEquals(12, $this->plugin->getCurrentDBVersion());
81  $this->assertEquals($this->data_factory->version("1.0.0"), $this->plugin->getAvailableVersion());
82  $this->assertEquals($this->data_factory->version("6.0"), $this->plugin->getMinimumILIASVersion());
83  $this->assertEquals($this->data_factory->version("6.99"), $this->plugin->getMaximumILIASVersion());
84  $this->assertEquals("Richard Klees", $this->plugin->getResponsible());
85  $this->assertEquals("richard.klees@concepts-and-training.de", $this->plugin->getResponsibleMail());
86  $this->assertTrue($this->plugin->supportsLearningProgress());
87  $this->assertFalse($this->plugin->supportsExport());
88  $this->assertTrue($this->plugin->supportsCLISetup());
89  }

◆ testIsActivationPossible()

ilPluginInfoTest::testIsActivationPossible ( bool  $is_installed,
bool  $supports_current_ilias,
bool  $needs_update,
bool  $is_version_to_old,
bool  $is_activation_possible 
)

isActivationPossibleTruthTable

Definition at line 281 of file ilPluginInfoTest.php.

References ILIAS\GlobalScreen\Provider\__construct(), and ilPluginInfo\isActivationPossible().

287  : void {
288  $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_version_to_old) extends ilPluginInfo {
289  protected bool $is_installed;
290  protected bool $supports_current_ilias;
291  protected bool $needs_update;
292  protected bool $is_version_to_old;
293 
294  public function __construct(
295  bool $is_installed,
296  bool $supports_current_ilias,
297  bool $needs_update,
298  bool $is_version_to_old
299  ) {
300  $this->is_installed = $is_installed;
301  $this->supports_current_ilias = $supports_current_ilias;
302  $this->needs_update = $needs_update;
303  $this->is_version_to_old = $is_version_to_old;
304  }
305 
306  public function isInstalled(): bool
307  {
308  return $this->is_installed;
309  }
310 
311  public function isUpdateRequired(): bool
312  {
313  return $this->needs_update;
314  }
315 
316  public function isCompliantToILIAS(): bool
317  {
318  return $this->supports_current_ilias;
319  }
320 
321  public function isVersionToOld(): bool
322  {
323  return $this->is_version_to_old;
324  }
325  };
326 
327  $this->assertEquals($is_activation_possible, $plugin->isActivationPossible());
328  }
isActivationPossible()
Can this plugin be activated right now.
ilPluginInfo $plugin
Simple value class for information about a plugin.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

◆ testIsActive()

ilPluginInfoTest::testIsActive ( bool  $is_installed,
bool  $supports_current_ilias,
bool  $needs_update,
bool  $is_activated,
bool  $is_version_to_old,
bool  $is_activation_possible 
)

isActiveTruthTable

Definition at line 356 of file ilPluginInfoTest.php.

References ILIAS\GlobalScreen\Provider\__construct(), and ilPluginInfo\isActive().

363  : void {
364  $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_activated, $is_version_to_old) extends ilPluginInfo {
365  protected bool $is_installed;
366  protected bool $supports_current_ilias;
367  protected bool $needs_update;
368  protected bool $is_activated;
369  protected bool $is_version_to_old;
370 
371  public function __construct(
372  bool $is_installed,
373  bool $supports_current_ilias,
374  bool $needs_update,
375  bool $is_activated,
376  bool $is_version_to_old
377  ) {
378  $this->is_installed = $is_installed;
379  $this->supports_current_ilias = $supports_current_ilias;
380  $this->needs_update = $needs_update;
381  $this->is_activated = $is_activated;
382  $this->is_version_to_old = $is_version_to_old;
383  }
384 
385  public function isActivated(): bool
386  {
387  return $this->is_activated;
388  }
389 
390  public function isInstalled(): bool
391  {
392  return $this->is_installed;
393  }
394 
395  public function isUpdateRequired(): bool
396  {
397  return $this->needs_update;
398  }
399 
400  public function isCompliantToILIAS(): bool
401  {
402  return $this->supports_current_ilias;
403  }
404 
405  public function isVersionToOld(): bool
406  {
407  return $this->is_version_to_old;
408  }
409  };
410 
411  $this->assertEquals($is_activation_possible, $plugin->isActive());
412  }
isActive()
Is this plugin active right now?
ilPluginInfo $plugin
Simple value class for information about a plugin.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

◆ testIsCompliantToILIAS()

ilPluginInfoTest::testIsCompliantToILIAS ( Data\Version  $version,
bool  $is_compliant 
)

versionCompliance

Definition at line 221 of file ilPluginInfoTest.php.

References ilPluginInfo\isCompliantToILIAS().

221  : void
222  {
223  $plugin = new ilPluginInfo(
224  $version,
225  $this->pluginslot,
226  "plg1",
227  "Plugin1",
228  "Type1",
229  true,
230  $this->data_factory->version("1.2.2"),
231  12,
232  $this->data_factory->version("1.0.0"),
233  $this->data_factory->version("6.0"),
234  $this->data_factory->version("6.99"),
235  "Richard Klees",
236  "richard.klees@concepts-and-training.de",
237  true,
238  false,
239  true
240  );
241  $this->assertSame($is_compliant, $plugin->isCompliantToILIAS());
242  }
$version
Definition: plugin.php:25
isCompliantToILIAS()
"ILIAS Version compliance" tells if the plugin can be operated with the given ILIAS version...
ilPluginInfo $plugin
Simple value class for information about a plugin.
+ Here is the call graph for this function:

◆ testIsInstalled()

ilPluginInfoTest::testIsInstalled ( )

Definition at line 91 of file ilPluginInfoTest.php.

91  : void
92  {
93  $this->assertTrue($this->plugin->isInstalled());
94  }

◆ testIsNotInstalled()

ilPluginInfoTest::testIsNotInstalled ( )

Definition at line 96 of file ilPluginInfoTest.php.

References $pluginslot.

96  : void
97  {
98  $this->plugin = new ilPluginInfo(
99  $this->data_factory->version("6.5"),
101  "plg1",
102  "Plugin1",
103  "Type1",
104  true,
105  null,
106  null,
107  $this->data_factory->version("1.0.0"),
108  $this->data_factory->version("6.0"),
109  $this->data_factory->version("6.99"),
110  "Richard Klees",
111  "richard.klees@concepts-and-training.de",
112  true,
113  false,
114  true
115  );
116 
117  $this->assertFalse($this->plugin->isInstalled());
118  }
Simple value class for information about a plugin.
ilPluginSlotInfo $pluginslot

◆ testIsVersionOld()

ilPluginInfoTest::testIsVersionOld ( )

Definition at line 173 of file ilPluginInfoTest.php.

References $pluginslot.

173  : void
174  {
175  $this->assertFalse($this->plugin->isVersionToOld());
176 
177  $plugin = new ilPluginInfo(
178  $this->data_factory->version("6.5"),
180  "plg1",
181  "Plugin1",
182  "Type1",
183  true,
184  $this->data_factory->version("1.0.0"),
185  12,
186  $this->data_factory->version("2.0.0"),
187  $this->data_factory->version("6.0"),
188  $this->data_factory->version("6.99"),
189  "Richard Klees",
190  "richard.klees@concepts-and-training.de",
191  true,
192  false,
193  true
194  );
195  $this->assertFalse($plugin->isVersionToOld());
196 
197  $plugin = new ilPluginInfo(
198  $this->data_factory->version("6.5"),
200  "plg1",
201  "Plugin1",
202  "Type1",
203  true,
204  $this->data_factory->version("1.2.2"),
205  12,
206  $this->data_factory->version("1.0.0"),
207  $this->data_factory->version("6.0"),
208  $this->data_factory->version("6.99"),
209  "Richard Klees",
210  "richard.klees@concepts-and-training.de",
211  true,
212  false,
213  true
214  );
215  $this->assertTrue($plugin->isVersionToOld());
216  }
ilPluginInfo $plugin
Simple value class for information about a plugin.
ilPluginSlotInfo $pluginslot

◆ testUpdateIsNotRequired()

ilPluginInfoTest::testUpdateIsNotRequired ( )

Definition at line 120 of file ilPluginInfoTest.php.

120  : void
121  {
122  $this->assertFalse($this->plugin->isUpdateRequired());
123  }

◆ testUpdateIsNotRequiredNotInstalled()

ilPluginInfoTest::testUpdateIsNotRequiredNotInstalled ( )

Definition at line 125 of file ilPluginInfoTest.php.

References $pluginslot.

125  : void
126  {
127  $this->plugin = new ilPluginInfo(
128  $this->data_factory->version("6.5"),
130  "plg1",
131  "Plugin1",
132  "Type1",
133  true,
134  null,
135  null,
136  $this->data_factory->version("1.0.0"),
137  $this->data_factory->version("6.0"),
138  $this->data_factory->version("6.99"),
139  "Richard Klees",
140  "richard.klees@concepts-and-training.de",
141  true,
142  false,
143  true
144  );
145 
146  $this->assertFalse($this->plugin->isUpdateRequired());
147  }
Simple value class for information about a plugin.
ilPluginSlotInfo $pluginslot

◆ testUpdateIsRequired()

ilPluginInfoTest::testUpdateIsRequired ( )

Definition at line 149 of file ilPluginInfoTest.php.

References $pluginslot.

149  : void
150  {
151  $this->plugin = new ilPluginInfo(
152  $this->data_factory->version("6.5"),
154  "plg1",
155  "Plugin1",
156  "Type1",
157  true,
158  $this->data_factory->version("2.0.0"),
159  11,
160  $this->data_factory->version("1.0.0"),
161  $this->data_factory->version("6.0"),
162  $this->data_factory->version("6.99"),
163  "Richard Klees",
164  "richard.klees@concepts-and-training.de",
165  true,
166  false,
167  true
168  );
169 
170  $this->assertTrue($this->plugin->isUpdateRequired());
171  }
Simple value class for information about a plugin.
ilPluginSlotInfo $pluginslot

◆ versionCompliance()

static ilPluginInfoTest::versionCompliance ( )
static

Definition at line 244 of file ilPluginInfoTest.php.

244  : array
245  {
246  $data_factory = new Data\Factory();
247  return [
248  [$data_factory->version("5.4"), false],
249  [$data_factory->version("6.5"), true],
250  [$data_factory->version("7.1"), false]
251  ];
252  }
Data Factory $data_factory

Field Documentation

◆ $component

ilComponentInfo ilPluginInfoTest::$component = null
protected

Definition at line 26 of file ilPluginInfoTest.php.

◆ $data_factory

Data Factory ilPluginInfoTest::$data_factory = null
protected

Definition at line 25 of file ilPluginInfoTest.php.

◆ $plugin

ilPluginInfo ilPluginInfoTest::$plugin = null
protected

Definition at line 28 of file ilPluginInfoTest.php.

◆ $pluginslot

ilPluginSlotInfo ilPluginInfoTest::$pluginslot = null
protected

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