ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 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 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()

static ilPluginInfoTest::isActivationPossibleTruthTable ( )
static

Definition at line 325 of file ilPluginInfoTest.php.

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

◆ isActiveTruthTable()

static ilPluginInfoTest::isActiveTruthTable ( )
static

Definition at line 407 of file ilPluginInfoTest.php.

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

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 "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 259 of file ilPluginInfoTest.php.

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

◆ testGetConfigureClassName()

ilPluginInfoTest::testGetConfigureClassName ( )

Definition at line 267 of file ilPluginInfoTest.php.

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

◆ testGetPath()

ilPluginInfoTest::testGetPath ( )

Definition at line 251 of file ilPluginInfoTest.php.

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

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 
)

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

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

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