ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 22 of file ilPluginInfoTest.php.

Member Function Documentation

◆ inactivityReasonTable()

static ilPluginInfoTest::inactivityReasonTable ( )
static

Definition at line 538 of file ilPluginInfoTest.php.

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

◆ isActivationPossibleTruthTable()

static ilPluginInfoTest::isActivationPossibleTruthTable ( )
static

Definition at line 329 of file ilPluginInfoTest.php.

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

◆ isActiveTruthTable()

static ilPluginInfoTest::isActiveTruthTable ( )
static

Definition at line 413 of file ilPluginInfoTest.php.

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

◆ setUp()

ilPluginInfoTest::setUp ( )
protected

Definition at line 29 of file ilPluginInfoTest.php.

References $pluginslot.

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

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

◆ testGetConfigureClassName()

ilPluginInfoTest::testGetConfigureClassName ( )

Definition at line 269 of file ilPluginInfoTest.php.

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

◆ testGetPath()

ilPluginInfoTest::testGetPath ( )

Definition at line 253 of file ilPluginInfoTest.php.

References ilComponentRepository\PLUGIN_BASE_PATH.

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

◆ 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 457 of file ilPluginInfoTest.php.

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

464  : void {
465  $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_activated, $is_version_to_old) extends ilPluginInfo {
466  protected bool $is_installed;
467  protected bool $supports_current_ilias;
468  protected bool $needs_update;
469  protected bool $is_activated;
470  protected bool $is_version_to_old;
471 
472  public function __construct(
473  bool $is_installed,
474  bool $supports_current_ilias,
475  bool $needs_update,
476  bool $is_activated,
477  bool $is_version_to_old
478  ) {
479  $this->is_installed = $is_installed;
480  $this->supports_current_ilias = $supports_current_ilias;
481  $this->needs_update = $needs_update;
482  $this->is_activated = $is_activated;
483  $this->is_version_to_old = $is_version_to_old;
484  }
485 
486  public function isActivated(): bool
487  {
488  return $this->is_activated;
489  }
490 
491  public function isInstalled(): bool
492  {
493  return $this->is_installed;
494  }
495 
496  public function isUpdateRequired(): bool
497  {
498  return $this->needs_update;
499  }
500 
501  public function isCompliantToILIAS(): bool
502  {
503  return $this->supports_current_ilias;
504  }
505 
506  public function getCurrentVersion(): ?Data\Version
507  {
508  return $this->current_version;
509  }
510 
511  public function isVersionToOld(): bool
512  {
513  return $this->is_version_to_old;
514  }
515  };
516 
517  $this->assertEquals($inactivity_reason, $plugin->getReasonForInactivity());
518  }
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 520 of file ilPluginInfoTest.php.

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

520  : void
521  {
522  $this->expectException(LogicException::class);
523 
524  $plugin = new class () extends ilPluginInfo {
525  public function __construct()
526  {
527  }
528 
529  public function isActive(): bool
530  {
531  return true;
532  }
533  };
534 
536  }
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 70 of file ilPluginInfoTest.php.

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

◆ 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 280 of file ilPluginInfoTest.php.

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

286  : void {
287  $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_version_to_old) extends ilPluginInfo {
288  protected bool $is_installed;
289  protected bool $supports_current_ilias;
290  protected bool $needs_update;
291  protected bool $is_version_to_old;
292 
293  public function __construct(
294  bool $is_installed,
295  bool $supports_current_ilias,
296  bool $needs_update,
297  bool $is_version_to_old
298  ) {
299  $this->is_installed = $is_installed;
300  $this->supports_current_ilias = $supports_current_ilias;
301  $this->needs_update = $needs_update;
302  $this->is_version_to_old = $is_version_to_old;
303  }
304 
305  public function isInstalled(): bool
306  {
307  return $this->is_installed;
308  }
309 
310  public function isUpdateRequired(): bool
311  {
312  return $this->needs_update;
313  }
314 
315  public function isCompliantToILIAS(): bool
316  {
317  return $this->supports_current_ilias;
318  }
319 
320  public function isVersionToOld(): bool
321  {
322  return $this->is_version_to_old;
323  }
324  };
325 
326  $this->assertEquals($is_activation_possible, $plugin->isActivationPossible());
327  }
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 355 of file ilPluginInfoTest.php.

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

362  : void {
363  $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_activated, $is_version_to_old) extends ilPluginInfo {
364  protected bool $is_installed;
365  protected bool $supports_current_ilias;
366  protected bool $needs_update;
367  protected bool $is_activated;
368  protected bool $is_version_to_old;
369 
370  public function __construct(
371  bool $is_installed,
372  bool $supports_current_ilias,
373  bool $needs_update,
374  bool $is_activated,
375  bool $is_version_to_old
376  ) {
377  $this->is_installed = $is_installed;
378  $this->supports_current_ilias = $supports_current_ilias;
379  $this->needs_update = $needs_update;
380  $this->is_activated = $is_activated;
381  $this->is_version_to_old = $is_version_to_old;
382  }
383 
384  public function isActivated(): bool
385  {
386  return $this->is_activated;
387  }
388 
389  public function isInstalled(): bool
390  {
391  return $this->is_installed;
392  }
393 
394  public function isUpdateRequired(): bool
395  {
396  return $this->needs_update;
397  }
398 
399  public function isCompliantToILIAS(): bool
400  {
401  return $this->supports_current_ilias;
402  }
403 
404  public function isVersionToOld(): bool
405  {
406  return $this->is_version_to_old;
407  }
408  };
409 
410  $this->assertEquals($is_activation_possible, $plugin->isActive());
411  }
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 220 of file ilPluginInfoTest.php.

References ilPluginInfo\isCompliantToILIAS().

220  : void
221  {
222  $plugin = new ilPluginInfo(
223  $version,
224  $this->pluginslot,
225  "plg1",
226  "Plugin1",
227  "Type1",
228  true,
229  $this->data_factory->version("1.2.2"),
230  12,
231  $this->data_factory->version("1.0.0"),
232  $this->data_factory->version("6.0"),
233  $this->data_factory->version("6.99"),
234  "Richard Klees",
235  "richard.klees@concepts-and-training.de",
236  true,
237  false,
238  true
239  );
240  $this->assertSame($is_compliant, $plugin->isCompliantToILIAS());
241  }
$version
Definition: plugin.php:24
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 90 of file ilPluginInfoTest.php.

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

◆ testIsNotInstalled()

ilPluginInfoTest::testIsNotInstalled ( )

Definition at line 95 of file ilPluginInfoTest.php.

References $pluginslot, and null.

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

◆ testIsVersionOld()

ilPluginInfoTest::testIsVersionOld ( )

Definition at line 172 of file ilPluginInfoTest.php.

References $pluginslot.

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

◆ testUpdateIsNotRequired()

ilPluginInfoTest::testUpdateIsNotRequired ( )

Definition at line 119 of file ilPluginInfoTest.php.

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

◆ testUpdateIsNotRequiredNotInstalled()

ilPluginInfoTest::testUpdateIsNotRequiredNotInstalled ( )

Definition at line 124 of file ilPluginInfoTest.php.

References $pluginslot, and null.

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

◆ testUpdateIsRequired()

ilPluginInfoTest::testUpdateIsRequired ( )

Definition at line 148 of file ilPluginInfoTest.php.

References $pluginslot.

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

◆ versionCompliance()

static ilPluginInfoTest::versionCompliance ( )
static

Definition at line 243 of file ilPluginInfoTest.php.

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

Field Documentation

◆ $component

ilComponentInfo ilPluginInfoTest::$component = null
protected

Definition at line 25 of file ilPluginInfoTest.php.

◆ $data_factory

Data Factory ilPluginInfoTest::$data_factory = null
protected

Definition at line 24 of file ilPluginInfoTest.php.

◆ $plugin

ilPluginInfo ilPluginInfoTest::$plugin = null
protected

Definition at line 27 of file ilPluginInfoTest.php.

◆ $pluginslot

ilPluginSlotInfo ilPluginInfoTest::$pluginslot = null
protected

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