ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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)
 
 testGetPath ()
 
 testGetPathIsNormalized ()
 ilComponentRepository::PLUGIN_BASE_PATH is built from DIR, the "../../../.." it carries must not show up in the path handed out to a plugin. More...
 
 testGetClassName ()
 
 testGetConfigureClassName ()
 
 testIsActivationPossible (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_version_to_old, bool $is_activation_possible)
 
 testIsActive (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_activated, bool $is_version_to_old, bool $is_activation_possible)
 
 testGetReasonForInactivity (bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_activated, bool $is_version_to_old, string $inactivity_reason)
 
 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 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 334 of file ilPluginInfoTest.php.

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

◆ isActiveTruthTable()

static ilPluginInfoTest::isActiveTruthTable ( )
static

Definition at line 416 of file ilPluginInfoTest.php.

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

◆ 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 "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"),
52 $this->pluginslot,
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 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 268 of file ilPluginInfoTest.php.

268 : void
269 {
270 $this->assertEquals(
271 "ilPlugin1Plugin",
272 $this->plugin->getClassName()
273 );
274 }

◆ testGetConfigureClassName()

ilPluginInfoTest::testGetConfigureClassName ( )

Definition at line 276 of file ilPluginInfoTest.php.

276 : void
277 {
278 $this->assertEquals(
279 "ilPlugin1ConfigGUI",
280 $this->plugin->getConfigGUIClassName()
281 );
282 }

◆ testGetPath()

ilPluginInfoTest::testGetPath ( )

Definition at line 251 of file ilPluginInfoTest.php.

251 : void
252 {
253 $this->assertEquals(
254 dirname(__DIR__, 4) . "/public/Customizing/global/plugins/Type1/Module1/Slot1/Plugin1",
255 $this->plugin->getPath()
256 );
257 }

◆ testGetPathIsNormalized()

ilPluginInfoTest::testGetPathIsNormalized ( )

ilComponentRepository::PLUGIN_BASE_PATH is built from DIR, the "../../../.." it carries must not show up in the path handed out to a plugin.

See 0046652.

Definition at line 263 of file ilPluginInfoTest.php.

263 : void
264 {
265 $this->assertStringNotContainsString('..', $this->plugin->getPath());
266 }

◆ testGetReasonForInactivity()

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

Definition at line 458 of file ilPluginInfoTest.php.

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 }
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 521 of file ilPluginInfoTest.php.

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 }

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

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

Definition at line 285 of file ilPluginInfoTest.php.

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

Definition at line 358 of file ilPluginInfoTest.php.

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

◆ testIsCompliantToILIAS()

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

Definition at line 218 of file ilPluginInfoTest.php.

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

95 : void
96 {
97 $this->plugin = new ilPluginInfo(
98 $this->data_factory->version("6.5"),
99 $this->pluginslot,
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 }

◆ testIsVersionOld()

ilPluginInfoTest::testIsVersionOld ( )

Definition at line 172 of file ilPluginInfoTest.php.

172 : void
173 {
174 $this->assertFalse($this->plugin->isVersionToOld());
175
176 $plugin = new ilPluginInfo(
177 $this->data_factory->version("6.5"),
178 $this->pluginslot,
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"),
198 $this->pluginslot,
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 }
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 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.

124 : void
125 {
126 $this->plugin = new ilPluginInfo(
127 $this->data_factory->version("6.5"),
128 $this->pluginslot,
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 }

◆ testUpdateIsRequired()

ilPluginInfoTest::testUpdateIsRequired ( )

Definition at line 148 of file ilPluginInfoTest.php.

148 : void
149 {
150 $this->plugin = new ilPluginInfo(
151 $this->data_factory->version("6.5"),
152 $this->pluginslot,
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 }

◆ versionCompliance()

static ilPluginInfoTest::versionCompliance ( )
static

Definition at line 241 of file ilPluginInfoTest.php.

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

References $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.

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: