ILIAS  release_8 Revision v8.24
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)
 @dataProvider versionCompliance More...
 
 versionCompliance ()
 
 testGetPath ()
 
 testGetClassName ()
 
 testGetConfigureClassName ()
 
 testIsActivationPossible (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_version_to_old, bool $is_activation_possible)
 @dataProvider isActivationPossibleTruthTable More...
 
 isActivationPossibleTruthTable ()
 
 testIsActive (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_activated, bool $is_version_to_old, bool $is_activation_possible)
 @dataProvider isActiveTruthTable More...
 
 isActiveTruthTable ()
 
 testGetReasonForInactivity (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_activated, bool $is_version_to_old, string $inactivity_reason)
 @dataProvider inactivityReasonTable More...
 
 testGetReasonForInactivityThrowsOnActivePlugin ()
 
 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()

ilPluginInfoTest::inactivityReasonTable ( )

Definition at line 530 of file ilPluginInfoTest.php.

530 : array
531 {
532 // is_installed, supports_current_ilias, needs_update, is_activated, is_version_to_old => inactivity_reason
533 return [
534 [false, false, false, false, false, "cmps_needs_matching_ilias_version"],
535 [false, false, false, true, false, "cmps_needs_matching_ilias_version"],
536 [false, false, true , false, false, "cmps_needs_matching_ilias_version"],
537 [false, false, true , true, false, "cmps_needs_matching_ilias_version"],
538 [false, true, false, false, false, "cmps_must_installed"],
539 [false, true, false, true, false, "cmps_must_installed"],
540 [false, true, true , false, false, "cmps_must_installed"],
541 [false, true, true , true, false, "cmps_must_installed"],
542 [true, false, false, false, false, "cmps_needs_matching_ilias_version"],
543 [true, false, false, true, false, "cmps_needs_matching_ilias_version"],
544 [true, false, true , false, false, "cmps_needs_matching_ilias_version"],
545 [true, false, true , true, false, "cmps_needs_matching_ilias_version"],
546 [true, true, false, false, false, "cmps_not_activated"],
547 [true, true, true , false, false, "cmps_needs_update"],
548 [true, true, true , true, false, "cmps_needs_update"],
549 [false, false, false, false, true, "cmps_needs_matching_ilias_version"],
550 [false, false, false, true, true, "cmps_needs_matching_ilias_version"],
551 [false, false, true , false, true, "cmps_needs_matching_ilias_version"],
552 [false, false, true , true, true, "cmps_needs_matching_ilias_version"],
553 [false, true, false, false, true, "cmps_must_installed"],
554 [false, true, false, true, true, "cmps_must_installed"],
555 [false, true, true , false, true, "cmps_must_installed"],
556 [false, true, true , true, true, "cmps_must_installed"],
557 [true, false, false, false, true, "cmps_needs_matching_ilias_version"],
558 [true, false, false, true, true, "cmps_needs_matching_ilias_version"],
559 [true, false, true , false, true, "cmps_needs_matching_ilias_version"],
560 [true, false, true , true, true, "cmps_needs_matching_ilias_version"],
561 [true, true, false, false, true, "cmps_needs_upgrade"],
562 [true, true, true , false, true, "cmps_needs_upgrade"],
563 [true, true, true , true, true, "cmps_needs_upgrade"],
564 ];
565 }
return true

References true.

◆ isActivationPossibleTruthTable()

ilPluginInfoTest::isActivationPossibleTruthTable ( )

Definition at line 321 of file ilPluginInfoTest.php.

321 : array
322 {
323 // is_installed, supports_current_ilias, needs_update, is_version_to_old => is_activation_possible
324 return [
325 [false, false, false, false, false],
326 [false, false, true, false, false],
327 [false, true, false, false, false],
328 [false, true, true, false, false],
329 [true, false, false, false, false],
330 [true, false, true, false, false],
331 [true, true, false, false, true],
332 [true, true, true, true, false],
333 [false, false, false, true, false],
334 [false, false, true, true, false],
335 [false, true, false, true, false],
336 [false, true, true, true, false],
337 [true, false, false, true, false],
338 [true, false, true, true, false],
339 [true, true, false, true, false],
340 [true, true, true, true, false]
341 ];
342 }

◆ isActiveTruthTable()

ilPluginInfoTest::isActiveTruthTable ( )

Definition at line 405 of file ilPluginInfoTest.php.

405 : array
406 {
407 // is_installed, supports_current_ilias, needs_update, is_activated, is_version_to_old => is_active
408 return [
409 [false, false, false, false, false, false],
410 [false, false, false, true, false, false],
411 [false, false, true , false, false, false],
412 [false, false, true , true, false, false],
413 [false, true, false, false, false, false],
414 [false, true, false, true, false, false],
415 [false, true, true , false, false, false],
416 [false, true, true , true, false, false],
417 [true, false, false, false, false, false],
418 [true, false, false, true, false, false],
419 [true, false, true , false, false, false],
420 [true, false, true , true, false, false],
421 [true, true, false, false, false, false],
422 [true, true, false, true, false, true],
423 [true, true, true , false, false, false],
424 [true, true, true , true, false, false],
425
426 [false, false, false, false, true, false],
427 [false, false, false, true, true, false],
428 [false, false, true , false, true, false],
429 [false, false, true , true, true, false],
430 [false, true, false, false, true, false],
431 [false, true, false, true, true, false],
432 [false, true, true , false, true, false],
433 [false, true, true , true, true, false],
434 [true, false, false, false, true, false],
435 [true, false, false, true, true, false],
436 [true, false, true , false, true, false],
437 [true, false, true , true, true, false],
438 [true, true, false, false, true, false],
439 [true, true, false, true, true, false],
440 [true, true, true , false, true, false],
441 [true, true, true , true, true, false],
442 ];
443 }

References true.

◆ setUp()

ilPluginInfoTest::setUp ( )
protected

Definition at line 29 of file ilPluginInfoTest.php.

29 : void
30 {
31 $this->data_factory = new Data\Factory();
32
33 $slots = [];
34 $this->component = new ilComponentInfo(
35 "mod1",
36 "Modules",
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"),
52 $this->pluginslot,
53 "plg1",
54 "Plugin1",
55 true,
56 $this->data_factory->version("1.0.0"),
57 12,
58 $this->data_factory->version("1.0.0"),
59 $this->data_factory->version("6.0"),
60 $this->data_factory->version("6.99"),
61 "Richard Klees",
62 "richard.klees@concepts-and-training.de",
63 true,
64 false,
65 true
66 );
67 }
Simple value class for basic information about a component.
ilPluginSlotInfo $pluginslot
Simple value class for information about a plugin.
Simple value class for basic information about a pluginslot.

References $pluginslot.

◆ testGetClassName()

ilPluginInfoTest::testGetClassName ( )

Definition at line 253 of file ilPluginInfoTest.php.

253 : void
254 {
255 $this->assertEquals(
256 "ilPlugin1Plugin",
257 $this->plugin->getClassName()
258 );
259 }

◆ testGetConfigureClassName()

ilPluginInfoTest::testGetConfigureClassName ( )

Definition at line 261 of file ilPluginInfoTest.php.

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

◆ testGetPath()

ilPluginInfoTest::testGetPath ( )

Definition at line 245 of file ilPluginInfoTest.php.

245 : void
246 {
247 $this->assertEquals(
248 ilComponentRepository::PLUGIN_BASE_PATH . "/" . "Modules/Module1/Slot1/Plugin1",
249 $this->plugin->getPath()
250 );
251 }

References ilComponentRepository\PLUGIN_BASE_PATH.

◆ testGetReasonForInactivity()

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

@dataProvider inactivityReasonTable

Definition at line 449 of file ilPluginInfoTest.php.

456 : void {
457 $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_activated, $is_version_to_old) extends ilPluginInfo {
458 protected bool $is_installed;
459 protected bool $supports_current_ilias;
460 protected bool $needs_update;
461 protected bool $is_activated;
462 protected bool $is_version_to_old;
463
464 public function __construct(
465 bool $is_installed,
466 bool $supports_current_ilias,
467 bool $needs_update,
468 bool $is_activated,
469 bool $is_version_to_old
470 ) {
471 $this->is_installed = $is_installed;
472 $this->supports_current_ilias = $supports_current_ilias;
473 $this->needs_update = $needs_update;
474 $this->is_activated = $is_activated;
475 $this->is_version_to_old = $is_version_to_old;
476 }
477
478 public function isActivated(): bool
479 {
480 return $this->is_activated;
481 }
482
483 public function isInstalled(): bool
484 {
485 return $this->is_installed;
486 }
487
488 public function isUpdateRequired(): bool
489 {
490 return $this->needs_update;
491 }
492
493 public function isCompliantToILIAS(): bool
494 {
495 return $this->supports_current_ilias;
496 }
497
498 public function getCurrentVersion(): ?Data\Version
499 {
500 return $this->current_version;
501 }
502
503 public function isVersionToOld(): bool
504 {
505 return $this->is_version_to_old;
506 }
507 };
508
509 $this->assertEquals($inactivity_reason, $plugin->getReasonForInactivity());
510 }
A version number that consists of three numbers (major, minor, patch).
Definition: Version.php:27
ilPluginInfo $plugin
getReasonForInactivity()
Which is the reason for the inactivity?
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

◆ testGetReasonForInactivityThrowsOnActivePlugin()

ilPluginInfoTest::testGetReasonForInactivityThrowsOnActivePlugin ( )

Definition at line 512 of file ilPluginInfoTest.php.

512 : void
513 {
514 $this->expectException(LogicException::class);
515
516 $plugin = new class () extends ilPluginInfo {
517 public function __construct()
518 {
519 }
520
521 public function isActive(): bool
522 {
523 return true;
524 }
525 };
526
528 }

References XapiProxy\$plugin, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

◆ testGetter()

ilPluginInfoTest::testGetter ( )

Definition at line 69 of file ilPluginInfoTest.php.

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

◆ testIsActivationPossible()

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

@dataProvider isActivationPossibleTruthTable

Definition at line 272 of file ilPluginInfoTest.php.

278 : void {
279 $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_version_to_old) extends ilPluginInfo {
280 protected bool $is_installed;
281 protected bool $supports_current_ilias;
282 protected bool $needs_update;
283 protected bool $is_version_to_old;
284
285 public function __construct(
286 bool $is_installed,
287 bool $supports_current_ilias,
288 bool $needs_update,
289 bool $is_version_to_old
290 ) {
291 $this->is_installed = $is_installed;
292 $this->supports_current_ilias = $supports_current_ilias;
293 $this->needs_update = $needs_update;
294 $this->is_version_to_old = $is_version_to_old;
295 }
296
297 public function isInstalled(): bool
298 {
299 return $this->is_installed;
300 }
301
302 public function isUpdateRequired(): bool
303 {
304 return $this->needs_update;
305 }
306
307 public function isCompliantToILIAS(): bool
308 {
309 return $this->supports_current_ilias;
310 }
311
312 public function isVersionToOld(): bool
313 {
314 return $this->is_version_to_old;
315 }
316 };
317
318 $this->assertEquals($is_activation_possible, $plugin->isActivationPossible());
319 }
isActivationPossible()
Can this plugin be activated right now.

◆ 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 
)

@dataProvider isActiveTruthTable

Definition at line 347 of file ilPluginInfoTest.php.

354 : void {
355 $plugin = new class ($is_installed, $supports_current_ilias, $needs_update, $is_activated, $is_version_to_old) extends ilPluginInfo {
356 protected bool $is_installed;
357 protected bool $supports_current_ilias;
358 protected bool $needs_update;
359 protected bool $is_activated;
360 protected bool $is_version_to_old;
361
362 public function __construct(
363 bool $is_installed,
364 bool $supports_current_ilias,
365 bool $needs_update,
366 bool $is_activated,
367 bool $is_version_to_old
368 ) {
369 $this->is_installed = $is_installed;
370 $this->supports_current_ilias = $supports_current_ilias;
371 $this->needs_update = $needs_update;
372 $this->is_activated = $is_activated;
373 $this->is_version_to_old = $is_version_to_old;
374 }
375
376 public function isActivated(): bool
377 {
378 return $this->is_activated;
379 }
380
381 public function isInstalled(): bool
382 {
383 return $this->is_installed;
384 }
385
386 public function isUpdateRequired(): bool
387 {
388 return $this->needs_update;
389 }
390
391 public function isCompliantToILIAS(): bool
392 {
393 return $this->supports_current_ilias;
394 }
395
396 public function isVersionToOld(): bool
397 {
398 return $this->is_version_to_old;
399 }
400 };
401
402 $this->assertEquals($is_activation_possible, $plugin->isActive());
403 }
isActive()
Is this plugin active right now?

◆ testIsCompliantToILIAS()

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

@dataProvider versionCompliance

Definition at line 213 of file ilPluginInfoTest.php.

213 : void
214 {
215 $plugin = new ilPluginInfo(
216 $version,
217 $this->pluginslot,
218 "plg1",
219 "Plugin1",
220 true,
221 $this->data_factory->version("1.2.2"),
222 12,
223 $this->data_factory->version("1.0.0"),
224 $this->data_factory->version("6.0"),
225 $this->data_factory->version("6.99"),
226 "Richard Klees",
227 "richard.klees@concepts-and-training.de",
228 true,
229 false,
230 true
231 );
232 $this->assertSame($is_compliant, $plugin->isCompliantToILIAS());
233 }
$version
Definition: plugin.php:24
isCompliantToILIAS()
"ILIAS Version compliance" tells if the plugin can be operated with the given ILIAS version.

References $plugin, $version, and ilPluginInfo\isCompliantToILIAS().

+ Here is the call graph for this function:

◆ testIsInstalled()

ilPluginInfoTest::testIsInstalled ( )

Definition at line 88 of file ilPluginInfoTest.php.

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

◆ testIsNotInstalled()

ilPluginInfoTest::testIsNotInstalled ( )

Definition at line 93 of file ilPluginInfoTest.php.

93 : void
94 {
95 $this->plugin = new ilPluginInfo(
96 $this->data_factory->version("6.5"),
97 $this->pluginslot,
98 "plg1",
99 "Plugin1",
100 true,
101 null,
102 null,
103 $this->data_factory->version("1.0.0"),
104 $this->data_factory->version("6.0"),
105 $this->data_factory->version("6.99"),
106 "Richard Klees",
107 "richard.klees@concepts-and-training.de",
108 true,
109 false,
110 true
111 );
112
113 $this->assertFalse($this->plugin->isInstalled());
114 }

◆ testIsVersionOld()

ilPluginInfoTest::testIsVersionOld ( )

Definition at line 167 of file ilPluginInfoTest.php.

167 : void
168 {
169 $this->assertFalse($this->plugin->isVersionToOld());
170
171 $plugin = new ilPluginInfo(
172 $this->data_factory->version("6.5"),
173 $this->pluginslot,
174 "plg1",
175 "Plugin1",
176 true,
177 $this->data_factory->version("1.0.0"),
178 12,
179 $this->data_factory->version("2.0.0"),
180 $this->data_factory->version("6.0"),
181 $this->data_factory->version("6.99"),
182 "Richard Klees",
183 "richard.klees@concepts-and-training.de",
184 true,
185 false,
186 true
187 );
188 $this->assertFalse($plugin->isVersionToOld());
189
190 $plugin = new ilPluginInfo(
191 $this->data_factory->version("6.5"),
192 $this->pluginslot,
193 "plg1",
194 "Plugin1",
195 true,
196 $this->data_factory->version("1.2.2"),
197 12,
198 $this->data_factory->version("1.0.0"),
199 $this->data_factory->version("6.0"),
200 $this->data_factory->version("6.99"),
201 "Richard Klees",
202 "richard.klees@concepts-and-training.de",
203 true,
204 false,
205 true
206 );
207 $this->assertTrue($plugin->isVersionToOld());
208 }
isVersionToOld()
"Version to old" tells if the plugin code has a version that is below the version that was updated la...

References $plugin, and ilPluginInfo\isVersionToOld().

+ Here is the call graph for this function:

◆ testUpdateIsNotRequired()

ilPluginInfoTest::testUpdateIsNotRequired ( )

Definition at line 116 of file ilPluginInfoTest.php.

116 : void
117 {
118 $this->assertFalse($this->plugin->isUpdateRequired());
119 }

◆ testUpdateIsNotRequiredNotInstalled()

ilPluginInfoTest::testUpdateIsNotRequiredNotInstalled ( )

Definition at line 121 of file ilPluginInfoTest.php.

121 : void
122 {
123 $this->plugin = new ilPluginInfo(
124 $this->data_factory->version("6.5"),
125 $this->pluginslot,
126 "plg1",
127 "Plugin1",
128 true,
129 null,
130 null,
131 $this->data_factory->version("1.0.0"),
132 $this->data_factory->version("6.0"),
133 $this->data_factory->version("6.99"),
134 "Richard Klees",
135 "richard.klees@concepts-and-training.de",
136 true,
137 false,
138 true
139 );
140
141 $this->assertFalse($this->plugin->isUpdateRequired());
142 }

◆ testUpdateIsRequired()

ilPluginInfoTest::testUpdateIsRequired ( )

Definition at line 144 of file ilPluginInfoTest.php.

144 : void
145 {
146 $this->plugin = new ilPluginInfo(
147 $this->data_factory->version("6.5"),
148 $this->pluginslot,
149 "plg1",
150 "Plugin1",
151 true,
152 $this->data_factory->version("2.0.0"),
153 11,
154 $this->data_factory->version("1.0.0"),
155 $this->data_factory->version("6.0"),
156 $this->data_factory->version("6.99"),
157 "Richard Klees",
158 "richard.klees@concepts-and-training.de",
159 true,
160 false,
161 true
162 );
163
164 $this->assertTrue($this->plugin->isUpdateRequired());
165 }

◆ versionCompliance()

ilPluginInfoTest::versionCompliance ( )

Definition at line 235 of file ilPluginInfoTest.php.

235 : array
236 {
237 $data_factory = new Data\Factory();
238 return [
239 [$data_factory->version("5.4"), false],
240 [$data_factory->version("6.5"), true],
241 [$data_factory->version("7.1"), false]
242 ];
243 }
version(string $version)
Definition: Factory.php:154
Data Factory $data_factory

References $data_factory, and ILIAS\Data\Factory\version().

+ Here is the call graph for this function:

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.

Referenced by versionCompliance().

◆ $plugin

ilPluginInfo ilPluginInfoTest::$plugin = null
protected

Definition at line 27 of file ilPluginInfoTest.php.

Referenced by testIsCompliantToILIAS(), and testIsVersionOld().

◆ $pluginslot

ilPluginSlotInfo ilPluginInfoTest::$pluginslot = null
protected

Definition at line 26 of file ilPluginInfoTest.php.

Referenced by setUp().


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