20use PHPUnit\Framework\TestCase;
29 protected function setUp(): void
31 $this->data_factory =
new Data\Factory();
51 $this->data_factory->version(
"6.5"),
57 $this->data_factory->version(
"1.0.0"),
59 $this->data_factory->version(
"1.0.0"),
60 $this->data_factory->version(
"6.0"),
61 $this->data_factory->version(
"6.99"),
63 "richard.klees@concepts-and-training.de",
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());
92 $this->assertTrue($this->plugin->isInstalled());
98 $this->data_factory->version(
"6.5"),
106 $this->data_factory->version(
"1.0.0"),
107 $this->data_factory->version(
"6.0"),
108 $this->data_factory->version(
"6.99"),
110 "richard.klees@concepts-and-training.de",
116 $this->assertFalse($this->plugin->isInstalled());
121 $this->assertFalse($this->plugin->isUpdateRequired());
127 $this->data_factory->version(
"6.5"),
135 $this->data_factory->version(
"1.0.0"),
136 $this->data_factory->version(
"6.0"),
137 $this->data_factory->version(
"6.99"),
139 "richard.klees@concepts-and-training.de",
145 $this->assertFalse($this->plugin->isUpdateRequired());
151 $this->data_factory->version(
"6.5"),
157 $this->data_factory->version(
"2.0.0"),
159 $this->data_factory->version(
"1.0.0"),
160 $this->data_factory->version(
"6.0"),
161 $this->data_factory->version(
"6.99"),
163 "richard.klees@concepts-and-training.de",
169 $this->assertTrue($this->plugin->isUpdateRequired());
174 $this->assertFalse($this->plugin->isVersionToOld());
177 $this->data_factory->version(
"6.5"),
183 $this->data_factory->version(
"1.0.0"),
185 $this->data_factory->version(
"2.0.0"),
186 $this->data_factory->version(
"6.0"),
187 $this->data_factory->version(
"6.99"),
189 "richard.klees@concepts-and-training.de",
197 $this->data_factory->version(
"6.5"),
203 $this->data_factory->version(
"1.2.2"),
205 $this->data_factory->version(
"1.0.0"),
206 $this->data_factory->version(
"6.0"),
207 $this->data_factory->version(
"6.99"),
209 "richard.klees@concepts-and-training.de",
217 #[\PHPUnit\Framework\Attributes\DataProvider('versionCompliance')]
227 $this->data_factory->version(
"1.2.2"),
229 $this->data_factory->version(
"1.0.0"),
230 $this->data_factory->version(
"6.0"),
231 $this->data_factory->version(
"6.99"),
233 "richard.klees@concepts-and-training.de",
254 dirname(__DIR__, 4) .
"/public/Customizing/global/plugins/Type1/Module1/Slot1/Plugin1",
255 $this->plugin->getPath()
265 $this->assertStringNotContainsString(
'..', $this->plugin->getPath());
272 $this->plugin->getClassName()
279 "ilPlugin1ConfigGUI",
280 $this->plugin->getConfigGUIClassName()
284 #[\PHPUnit\Framework\Attributes\DataProvider('isActivationPossibleTruthTable')]
287 bool $supports_current_ilias,
289 bool $is_version_to_old,
290 bool $is_activation_possible
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;
300 bool $supports_current_ilias,
302 bool $is_version_to_old
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;
310 public function isInstalled(): bool
312 return $this->is_installed;
315 public function isUpdateRequired(): bool
317 return $this->needs_update;
320 public function isCompliantToILIAS(): bool
322 return $this->supports_current_ilias;
325 public function isVersionToOld(): bool
327 return $this->is_version_to_old;
331 $this->assertEquals($is_activation_possible,
$plugin->isActivationPossible());
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]
357 #[\PHPUnit\Framework\Attributes\DataProvider('isActiveTruthTable')]
360 bool $supports_current_ilias,
363 bool $is_version_to_old,
364 bool $is_activation_possible
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;
375 bool $supports_current_ilias,
378 bool $is_version_to_old
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;
387 public function isActivated(): bool
389 return $this->is_activated;
392 public function isInstalled(): bool
394 return $this->is_installed;
397 public function isUpdateRequired(): bool
399 return $this->needs_update;
402 public function isCompliantToILIAS(): bool
404 return $this->supports_current_ilias;
407 public function isVersionToOld(): bool
409 return $this->is_version_to_old;
413 $this->assertEquals($is_activation_possible,
$plugin->isActive());
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],
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],
457 #[\PHPUnit\Framework\Attributes\DataProvider('inactivityReasonTable')]
460 bool $supports_current_ilias,
463 bool $is_version_to_old,
464 string $inactivity_reason
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;
475 bool $supports_current_ilias,
478 bool $is_version_to_old
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;
487 public function isActivated(): bool
489 return $this->is_activated;
492 public function isInstalled(): bool
494 return $this->is_installed;
497 public function isUpdateRequired(): bool
499 return $this->needs_update;
502 public function isCompliantToILIAS(): bool
504 return $this->supports_current_ilias;
509 return $this->current_version;
512 public function isVersionToOld(): bool
514 return $this->is_version_to_old;
518 $this->assertEquals($inactivity_reason,
$plugin->getReasonForInactivity());
523 $this->expectException(LogicException::class);
530 public function isActive():
bool
536 $plugin->getReasonForInactivity();
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"],
A version number that consists of three numbers (major, minor, patch).
Simple value class for basic information about a component.
testGetPathIsNormalized()
ilComponentRepository::PLUGIN_BASE_PATH is built from DIR, the "../../../.." it carries must not show...
testIsCompliantToILIAS(Data\Version $version, bool $is_compliant)
static isActivationPossibleTruthTable()
testIsActive(bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_activated, bool $is_version_to_old, bool $is_activation_possible)
testGetConfigureClassName()
testGetReasonForInactivityThrowsOnActivePlugin()
testUpdateIsNotRequiredNotInstalled()
static isActiveTruthTable()
testGetReasonForInactivity(bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_activated, bool $is_version_to_old, string $inactivity_reason)
static inactivityReasonTable()
testIsActivationPossible(bool $is_installed, bool $supports_current_ilias, bool $needs_update, bool $is_version_to_old, bool $is_activation_possible)
testUpdateIsNotRequired()
Data Factory $data_factory
ilPluginSlotInfo $pluginslot
static versionCompliance()
ilComponentInfo $component
Simple value class for information about a plugin.
isCompliantToILIAS()
"ILIAS Version compliance" tells if the plugin can be operated with the given ILIAS version.
isVersionToOld()
"Version to old" tells if the plugin code has a version that is below the version that was updated la...
Simple value class for basic information about a pluginslot.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc