ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilArtifactComponentRepositoryTest Class Reference
+ Inheritance diagram for ilArtifactComponentRepositoryTest:
+ Collaboration diagram for ilArtifactComponentRepositoryTest:

Public Member Functions

 testHasComponent ()
 
 testHasComponentThrowsOnUnknownType ()
 
 testHasComponentId ()
 
 testGetComponents ()
 
 testGetComponentById ()
 
 testGetComponentByTypeAndName ()
 
 testGetComponentByTypeAndNameThrowsOnUnknownComponent1 ()
 
 testGetComponentByTypeAndNameThrowsOnUnknownComponent2 ()
 
 testGetComponentByIdTypeThrowsOnInvalidId ()
 
 testGetPluginSlots ()
 
 testGetPluginslotById ()
 
 testNoPluginSlot ()
 
 testGetPlugins ()
 
 testGetPluginById ()
 
 testGetPluginByName ()
 
 testUnknownPlugin ()
 
 testUsesPluginStateDB ()
 
 testGetPluginViaComponentAndPluginSlot ()
 
 testSetCurrentPluginVersionCallsStateDB ()
 
 testSetCurrentPluginVersionCallsStateDBTriggersRebuild ()
 
 testCallBuildDatabaseTwice ()
 
 testSetActivationCallsStateDB ()
 
 testSetActivationTriggersRebuild ()
 
 testRemoveStateInformationOfCallsStateDB ()
 
 testRemoveStateInformationOfTriggersRebuild ()
 
 testHasPluginId ()
 
 testHasActivatedPlugin ()
 

Static Public Attributes

static array $component_data
 
static array $plugin_data
 

Protected Member Functions

 setUp ()
 

Protected Attributes

Data Factory $data_factory
 
PHPUnit Framework MockObject Stub $ilias_version
 
ilPluginStateDB $plugin_state_db
 
ilArtifactComponentRepository $db
 
ilComponentInfo $mod1
 
ilPluginSlotInfo $slt1
 
ilPluginInfo $plg1
 
ilPluginSlotInfo $slt2
 
ilComponentInfo $mod2
 
ilComponentInfo $ser1
 
ilPluginSlotInfo $slt3
 
ilComponentInfo $ser2
 
ilPluginSlotInfo $slt4
 
ilPluginInfo $plg2
 
ilPluginInfo $plg3
 

Detailed Description

Definition at line 22 of file ilArtifactComponentRepositoryTest.php.

Member Function Documentation

◆ setUp()

ilArtifactComponentRepositoryTest::setUp ( )
protected

Definition at line 103 of file ilArtifactComponentRepositoryTest.php.

103 : void
104 {
105 $this->data_factory = new Data\Factory();
106 $this->ilias_version = $this->createStub(Data\Version::class);
107 $this->plugin_state_db = new class () implements ilPluginStateDB {
108 public function isPluginActivated(string $id): bool
109 {
110 if ($id == 'plg3') {
111 return true;
112 }
113
114 return false;
115 }
116 public function setActivation(string $id, bool $activated): void
117 {
118 }
119 public function getCurrentPluginVersion(string $id): ?Data\Version
120 {
121 return (new Data\Factory())->version("0.9.1");
122 }
123 public function getCurrentPluginDBVersion(string $id): ?int
124 {
125 return 13;
126 }
127 public function setCurrentPluginVersion(string $id, Data\Version $version, int $db_version): void
128 {
129 }
130 public function remove(string $id): void
131 {
132 }
133 };
134
136 protected function readComponentData(): array
137 {
139 }
140 protected function readPluginData(): array
141 {
143 }
144 public function _buildDatabase(): void
145 {
146 $this->buildDatabase();
147 }
148 };
149
150 $slots1 = [];
151 $this->mod1 = new ilComponentInfo(
152 "mod1",
153 "components/ILIAS",
154 "Module1",
155 $slots1
156 );
157 $plugins1 = [];
158 $this->slt1 = new ilPluginSlotInfo(
159 $this->mod1,
160 "slt1",
161 "Slot1",
162 $plugins1
163 );
164 $this->plg1 = new ilPluginInfo(
165 $this->ilias_version,
166 $this->slt1,
167 "plg1",
168 "Plugin1",
169 "Type1",
170 false,
171 $this->data_factory->version("0.9.1"),
172 13,
173 $this->data_factory->version("1.9.1"),
174 $this->data_factory->version("8.0"),
175 $this->data_factory->version("8.999"),
176 "Richard Klees",
177 "richard.klees@concepts-and-training.de",
178 true,
179 false,
180 true
181 );
182 $plugins1["plg1"] = $this->plg1;
183 $plugins2 = [];
184 $this->slt2 = new ilPluginSlotInfo(
185 $this->mod1,
186 "slt2",
187 "Slot2",
188 $plugins2
189 );
190 $slots1 = ["slt1" => $this->slt1, "slt2" => $this->slt2];
191
192 $slots2 = [];
193 $this->mod2 = new ilComponentInfo(
194 "mod2",
195 "components/ILIAS",
196 "Module2",
197 $slots2
198 );
199
200 $slots3 = [];
201 $this->ser1 = new ilComponentInfo(
202 "ser1",
203 "components/ILIAS",
204 "Service1",
205 $slots3
206 );
207
208 $plugins3 = [];
209 $this->slt3 = new ilPluginSlotInfo(
210 $this->ser1,
211 "slt3",
212 "Slot3",
213 $plugins3
214 );
215 $slots3 = ["slt3" => $this->slt3];
216
217 $slots4 = [];
218 $this->ser2 = new ilComponentInfo(
219 "ser2",
220 "components/ILIAS",
221 "Service2",
222 $slots4
223 );
224 $plugins4 = [];
225 $this->slt4 = new ilPluginSlotInfo(
226 $this->ser2,
227 "slt4",
228 "Slot4",
229 $plugins4
230 );
231 $slots4 = ["slt4" => $this->slt4];
232
233 $this->plg2 = new ilPluginInfo(
234 $this->ilias_version,
235 $this->slt4,
236 "plg2",
237 "Plugin2",
238 "Type2",
239 false,
240 $this->data_factory->version("0.9.1"),
241 13,
242 $this->data_factory->version("2.9.1"),
243 $this->data_factory->version("8.1"),
244 $this->data_factory->version("8.999"),
245 "Richard Klees",
246 "richard.klees@concepts-and-training.de",
247 false,
248 true,
249 false
250 );
251 $plugins4["plg2"] = $this->plg2;
252
253 $this->plg3 = new ilPluginInfo(
254 $this->ilias_version,
255 $this->slt4,
256 "plg3",
257 "Plugin3",
258 "Type3",
259 true,
260 $this->data_factory->version("0.9.1"),
261 13,
262 $this->data_factory->version("2.9.2"),
263 $this->data_factory->version("8.1"),
264 $this->data_factory->version("8.999"),
265 "Richard Klees",
266 "richard.klees@concepts-and-training.de",
267 false,
268 true,
269 false
270 );
271 $plugins4["plg3"] = $this->plg3;
272 }
$version
Definition: plugin.php:24
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Builds data types.
Definition: Factory.php:36
A version number that consists of three numbers (major, minor, patch).
Definition: Version.php:27
PHPUnit Framework MockObject Stub $ilias_version
Repository for component data implemented over artifacts.
Simple value class for basic information about a component.
Simple value class for information about a plugin.
Simple value class for basic information about a pluginslot.
Repository interface for plugin state data.

References $component_data, $data_factory, $id, $ilias_version, $plg1, $plg2, $plg3, $plugin_data, $plugin_state_db, $slt1, $slt2, $slt3, $slt4, and $version.

◆ testCallBuildDatabaseTwice()

ilArtifactComponentRepositoryTest::testCallBuildDatabaseTwice ( )

Definition at line 587 of file ilArtifactComponentRepositoryTest.php.

587 : void
588 {
589 $this->db->_buildDatabase();
590
591 $this->assertEquals($this->mod1, $this->db->getComponentById("mod1"));
592 $this->assertEquals($this->mod1, $this->db->getComponentByTypeAndName("components/ILIAS", "Module1"));
593 $this->assertEquals($this->slt1, $this->db->getPluginSlotById("slt1"));
594 $this->assertEquals($this->plg1, $this->db->getPluginById("plg1"));
595 $this->assertEquals($this->plg2, $this->db->getPluginByName("Plugin2"));
596 }

◆ testGetComponentById()

ilArtifactComponentRepositoryTest::testGetComponentById ( )

Definition at line 321 of file ilArtifactComponentRepositoryTest.php.

321 : void
322 {
323 $this->assertEquals($this->mod1, $this->db->getComponentById("mod1"));
324 $this->assertEquals($this->mod2, $this->db->getComponentById("mod2"));
325 $this->assertEquals($this->ser1, $this->db->getComponentById("ser1"));
326 $this->assertEquals($this->ser2, $this->db->getComponentById("ser2"));
327 }

◆ testGetComponentByIdTypeThrowsOnInvalidId()

ilArtifactComponentRepositoryTest::testGetComponentByIdTypeThrowsOnInvalidId ( )

Definition at line 349 of file ilArtifactComponentRepositoryTest.php.

349 : void
350 {
351 $this->expectException(\InvalidArgumentException::class);
352 $this->db->getComponentById("some_id");
353 }

◆ testGetComponentByTypeAndName()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndName ( )

Definition at line 329 of file ilArtifactComponentRepositoryTest.php.

329 : void
330 {
331 $this->assertEquals($this->mod1, $this->db->getComponentByTypeAndName("components/ILIAS", "Module1"));
332 $this->assertEquals($this->mod2, $this->db->getComponentByTypeAndName("components/ILIAS", "Module2"));
333 $this->assertEquals($this->ser1, $this->db->getComponentByTypeAndName("components/ILIAS", "Service1"));
334 $this->assertEquals($this->ser2, $this->db->getComponentByTypeAndName("components/ILIAS", "Service2"));
335 }

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent1()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent1 ( )

Definition at line 337 of file ilArtifactComponentRepositoryTest.php.

337 : void
338 {
339 $this->expectException(\InvalidArgumentException::class);
340 $this->db->getComponentByTypeAndName("components/ILIAS", "Module3");
341 }

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent2()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent2 ( )

Definition at line 343 of file ilArtifactComponentRepositoryTest.php.

343 : void
344 {
345 $this->expectException(\InvalidArgumentException::class);
346 $this->db->getComponentByTypeAndName("OtherComponent", "Service1");
347 }

◆ testGetComponents()

ilArtifactComponentRepositoryTest::testGetComponents ( )

Definition at line 304 of file ilArtifactComponentRepositoryTest.php.

304 : void
305 {
306 $result = iterator_to_array($this->db->getComponents());
307
308 $ids = array_keys($result);
309 $expected_ids = ["mod1", "mod2", "ser1", "ser2"];
310 sort($ids);
311 sort($expected_ids);
312
313 $this->assertEquals($expected_ids, $ids);
314
315 $this->assertEquals($this->mod1, $result["mod1"]);
316 $this->assertEquals($this->mod2, $result["mod2"]);
317 $this->assertEquals($this->ser1, $result["ser1"]);
318 $this->assertEquals($this->ser2, $result["ser2"]);
319 }

References ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

+ Here is the call graph for this function:

◆ testGetPluginById()

ilArtifactComponentRepositoryTest::testGetPluginById ( )

Definition at line 412 of file ilArtifactComponentRepositoryTest.php.

412 : void
413 {
414 $this->assertEquals($this->plg1, $this->db->getPluginById("plg1"));
415 $this->assertEquals($this->plg2, $this->db->getPluginById("plg2"));
416 }

◆ testGetPluginByName()

ilArtifactComponentRepositoryTest::testGetPluginByName ( )

Definition at line 418 of file ilArtifactComponentRepositoryTest.php.

418 : void
419 {
420 $this->assertEquals($this->plg1, $this->db->getPluginByName("Plugin1"));
421 $this->assertEquals($this->plg2, $this->db->getPluginByName("Plugin2"));
422 }

◆ testGetPlugins()

ilArtifactComponentRepositoryTest::testGetPlugins ( )

Definition at line 397 of file ilArtifactComponentRepositoryTest.php.

397 : void
398 {
399 $plugins = iterator_to_array($this->db->getPlugins());
400
401 $ids = array_keys($plugins);
402 $expected_ids = ["plg1", "plg2", "plg3"];
403 sort($ids);
404 sort($expected_ids);
405
406 $this->assertEquals($expected_ids, $ids);
407
408 $this->assertEquals($this->plg1, $plugins["plg1"]);
409 $this->assertEquals($this->plg2, $plugins["plg2"]);
410 }

References ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

+ Here is the call graph for this function:

◆ testGetPluginslotById()

ilArtifactComponentRepositoryTest::testGetPluginslotById ( )

Definition at line 372 of file ilArtifactComponentRepositoryTest.php.

372 : void
373 {
374 $this->assertEquals($this->slt1, $this->db->getPluginSlotById("slt1"));
375 $this->assertEquals($this->slt2, $this->db->getPluginSlotById("slt2"));
376 $this->assertEquals($this->slt3, $this->db->getPluginSlotById("slt3"));
377 $this->assertEquals($this->slt4, $this->db->getPluginSlotById("slt4"));
378 }

◆ testGetPluginSlots()

ilArtifactComponentRepositoryTest::testGetPluginSlots ( )

Definition at line 355 of file ilArtifactComponentRepositoryTest.php.

355 : void
356 {
357 $slots = iterator_to_array($this->db->getPluginSlots());
358
359 $ids = array_keys($slots);
360 $expected_ids = ["slt1", "slt2", "slt3", "slt4"];
361 sort($ids);
362 sort($expected_ids);
363
364 $this->assertEquals($expected_ids, $ids);
365
366 $this->assertEquals($this->slt1, $slots["slt1"]);
367 $this->assertEquals($this->slt2, $slots["slt2"]);
368 $this->assertEquals($this->slt3, $slots["slt3"]);
369 $this->assertEquals($this->slt4, $slots["slt4"]);
370 }

References ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

+ Here is the call graph for this function:

◆ testGetPluginViaComponentAndPluginSlot()

ilArtifactComponentRepositoryTest::testGetPluginViaComponentAndPluginSlot ( )

Definition at line 481 of file ilArtifactComponentRepositoryTest.php.

481 : void
482 {
483 $plg1 = $this->db
484 ->getComponentByTypeAndName("components/ILIAS", "Module1")
485 ->getPluginSlotById("slt1")
486 ->getPluginById("plg1");
487
488 $this->assertEquals($this->plg1, $plg1);
489 }

References $plg1.

◆ testHasActivatedPlugin()

ilArtifactComponentRepositoryTest::testHasActivatedPlugin ( )

Definition at line 762 of file ilArtifactComponentRepositoryTest.php.

762 : void
763 {
764 $this->assertFalse($this->db->hasActivatedPlugin("plg1")); // exists, but is not activated
765 $this->assertFalse($this->db->hasActivatedPlugin("plg666")); // does not exist
766 $this->assertTrue($this->db->hasActivatedPlugin("plg3")); // exists and is activated
767 }

◆ testHasComponent()

ilArtifactComponentRepositoryTest::testHasComponent ( )

Definition at line 274 of file ilArtifactComponentRepositoryTest.php.

274 : void
275 {
276 $this->assertTrue($this->db->hasComponent("components/ILIAS", "Module1"));
277 $this->assertTrue($this->db->hasComponent("components/ILIAS", "Module2"));
278 $this->assertTrue($this->db->hasComponent("components/ILIAS", "Service1"));
279 $this->assertTrue($this->db->hasComponent("components/ILIAS", "Service2"));
280 $this->assertFalse($this->db->hasComponent("components/ILIAS", "Module3"));
281 $this->assertFalse($this->db->hasComponent("components/ILIAS", "Module4"));
282 $this->assertFalse($this->db->hasComponent("components/ILIAS", "Service3"));
283 $this->assertFalse($this->db->hasComponent("components/ILIAS", "Service4"));
284 }

◆ testHasComponentId()

ilArtifactComponentRepositoryTest::testHasComponentId ( )

Definition at line 292 of file ilArtifactComponentRepositoryTest.php.

292 : void
293 {
294 $this->assertTrue($this->db->hasComponentId("mod1"));
295 $this->assertTrue($this->db->hasComponentId("mod2"));
296 $this->assertTrue($this->db->hasComponentId("ser1"));
297 $this->assertTrue($this->db->hasComponentId("ser2"));
298 $this->assertFalse($this->db->hasComponentId("mod3"));
299 $this->assertFalse($this->db->hasComponentId("mod4"));
300 $this->assertFalse($this->db->hasComponentId("ser3"));
301 $this->assertFalse($this->db->hasComponentId("ser4"));
302 }

◆ testHasComponentThrowsOnUnknownType()

ilArtifactComponentRepositoryTest::testHasComponentThrowsOnUnknownType ( )

Definition at line 286 of file ilArtifactComponentRepositoryTest.php.

286 : void
287 {
288 $this->expectException(\InvalidArgumentException::class);
289 $this->db->hasComponent("OtherComponent", "Module1");
290 }

◆ testHasPluginId()

ilArtifactComponentRepositoryTest::testHasPluginId ( )

Definition at line 756 of file ilArtifactComponentRepositoryTest.php.

756 : void
757 {
758 $this->assertTrue($this->db->hasPluginId("plg1"));
759 $this->assertFalse($this->db->hasPluginId("plg666"));
760 }

◆ testNoPluginSlot()

ilArtifactComponentRepositoryTest::testNoPluginSlot ( )

Definition at line 380 of file ilArtifactComponentRepositoryTest.php.

380 : void
381 {
383 protected function readComponentData(): array
384 {
385 return ["mod2" => ["components/ILIAS", "Module2", []]];
386 }
387 protected function readPluginData(): array
388 {
389 return [];
390 }
391 };
392
393 $slots = iterator_to_array($db->getPluginSlots());
394 $this->assertEquals([], $slots);
395 }

References $data_factory, $db, $ilias_version, $plugin_state_db, and ilArtifactComponentRepository\getPluginSlots().

+ Here is the call graph for this function:

◆ testRemoveStateInformationOfCallsStateDB()

ilArtifactComponentRepositoryTest::testRemoveStateInformationOfCallsStateDB ( )

Definition at line 677 of file ilArtifactComponentRepositoryTest.php.

677 : void
678 {
679 $plugin_state_db = $this->createMock(ilPluginStateDB::class);
680
682 protected function readComponentData(): array
683 {
684 return ["mod1" => ["components/ILIAS", "Module1", [["slt1", "Slot1"]]]];
685 }
686 protected function readPluginData(): array
687 {
688 return [
689 "plg1" => [
690 "components/ILIAS",
691 "Module1",
692 "Slot1",
693 "Plugin1",
694 "1.9.1",
695 "8.0",
696 "8.999",
697 "Richard Klees",
698 "richard.klees@concepts-and-training.de",
699 true,
700 false,
701 null
702 ]
703 ];
704 }
705 };
706
707 $plugin_state_db->expects($this->once())
708 ->method("remove")
709 ->with("plg1");
710
712 }

References $data_factory, $db, $ilias_version, $plugin_state_db, and ilArtifactComponentRepository\removeStateInformationOf().

+ Here is the call graph for this function:

◆ testRemoveStateInformationOfTriggersRebuild()

ilArtifactComponentRepositoryTest::testRemoveStateInformationOfTriggersRebuild ( )

Definition at line 714 of file ilArtifactComponentRepositoryTest.php.

714 : void
715 {
716 $plugin_state_db = $this->createStub(ilPluginStateDB::class);
718 public int $build_called = 0;
719 protected function buildDatabase(): void
720 {
721 $this->build_called++;
722 parent::buildDatabase();
723 }
724 protected function readComponentData(): array
725 {
726 return ["mod1" => ["components/ILIAS", "Module1", [["slt1", "Slot1"]]]];
727 }
728 protected function readPluginData(): array
729 {
730 return [
731 "plg1" => [
732 "components/ILIAS",
733 "Module1",
734 "Slot1",
735 "Plugin1",
736 "1.9.1",
737 "8.0",
738 "8.999",
739 "Richard Klees",
740 "richard.klees@concepts-and-training.de",
741 true,
742 false,
743 null
744 ]
745 ];
746 }
747 };
748
749 $this->assertEquals(1, $db->build_called);
750
752
753 $this->assertEquals(2, $db->build_called);
754 }

References $data_factory, $db, $ilias_version, $plugin_state_db, and ilArtifactComponentRepository\removeStateInformationOf().

+ Here is the call graph for this function:

◆ testSetActivationCallsStateDB()

ilArtifactComponentRepositoryTest::testSetActivationCallsStateDB ( )

Definition at line 598 of file ilArtifactComponentRepositoryTest.php.

598 : void
599 {
600 $plugin_state_db = $this->createMock(ilPluginStateDB::class);
601
603 protected function readComponentData(): array
604 {
605 return ["mod1" => ["components/ILIAS", "Module1", [["slt1", "Slot1"]]]];
606 }
607 protected function readPluginData(): array
608 {
609 return [
610 "plg1" => [
611 "components/ILIAS",
612 "Module1",
613 "Slot1",
614 "Plugin1",
615 "1.9.1",
616 "8.0",
617 "8.999",
618 "Richard Klees",
619 "richard.klees@concepts-and-training.de",
620 true,
621 false,
622 null
623 ]
624 ];
625 }
626 };
627
628 $plugin_state_db->expects($this->once())
629 ->method("setActivation")
630 ->with("plg1", true);
631
632 $db->setActivation("plg1", true);
633 }
setActivation(string $plugin_id, bool $activated)

References $data_factory, $db, $ilias_version, $plugin_state_db, and ilArtifactComponentRepository\setActivation().

+ Here is the call graph for this function:

◆ testSetActivationTriggersRebuild()

ilArtifactComponentRepositoryTest::testSetActivationTriggersRebuild ( )

Definition at line 635 of file ilArtifactComponentRepositoryTest.php.

635 : void
636 {
637 $plugin_state_db = $this->createStub(ilPluginStateDB::class);
639 public int $build_called = 0;
640 protected function buildDatabase(): void
641 {
642 $this->build_called++;
643 parent::buildDatabase();
644 }
645 protected function readComponentData(): array
646 {
647 return ["mod1" => ["components/ILIAS", "Module1", [["slt1", "Slot1"]]]];
648 }
649 protected function readPluginData(): array
650 {
651 return [
652 "plg1" => [
653 "components/ILIAS",
654 "Module1",
655 "Slot1",
656 "Plugin1",
657 "1.9.1",
658 "8.0",
659 "8.999",
660 "Richard Klees",
661 "richard.klees@concepts-and-training.de",
662 true,
663 false,
664 null
665 ]
666 ];
667 }
668 };
669
670 $this->assertEquals(1, $db->build_called);
671
672 $db->setActivation("plg1", false);
673
674 $this->assertEquals(2, $db->build_called);
675 }

References $data_factory, $db, $ilias_version, $plugin_state_db, and ilArtifactComponentRepository\setActivation().

+ Here is the call graph for this function:

◆ testSetCurrentPluginVersionCallsStateDB()

ilArtifactComponentRepositoryTest::testSetCurrentPluginVersionCallsStateDB ( )

Definition at line 491 of file ilArtifactComponentRepositoryTest.php.

491 : void
492 {
493 $VERSION = $this->data_factory->version("1000.0.0");
494 $DB_VERSION = 1000;
495
496 $plugin_state_db = $this->createMock(ilPluginStateDB::class);
497 $plugin_state_db->expects($this->atLeastOnce())
498 ->method("isPluginActivated")
499 ->with("plg1")
500 ->willReturn(true);
501 $plugin_state_db->expects($this->atLeastOnce())
502 ->method("getCurrentPluginVersion")
503 ->with("plg1")
504 ->willReturn($this->data_factory->version("1.8.0"));
505 $plugin_state_db->expects($this->atLeastOnce())
506 ->method("getCurrentPluginDBVersion")
507 ->with("plg1")
508 ->willReturn(42);
509 $plugin_state_db->expects($this->once())
510 ->method("setCurrentPluginVersion")
511 ->with("plg1", $VERSION, $DB_VERSION);
512
514 protected function readComponentData(): array
515 {
516 return ["mod1" => ["components/ILIAS", "Module1", [["slt1", "Slot1"]]]];
517 }
518 protected function readPluginData(): array
519 {
520 return [
521 "plg1" => [
522 "components/ILIAS",
523 "Module1",
524 "Slot1",
525 "Plugin1",
526 "1.9.1",
527 "8.0",
528 "8.999",
529 "Richard Klees",
530 "richard.klees@concepts-and-training.de",
531 true,
532 false,
533 null
534 ]
535 ];
536 }
537 };
538
539 $db->setCurrentPluginVersion("plg1", $VERSION, $DB_VERSION);
540 }
setCurrentPluginVersion(string $plugin_id, Data\Version $version, int $db_version)

References $data_factory, $db, $ilias_version, $plugin_state_db, and ilArtifactComponentRepository\setCurrentPluginVersion().

+ Here is the call graph for this function:

◆ testSetCurrentPluginVersionCallsStateDBTriggersRebuild()

ilArtifactComponentRepositoryTest::testSetCurrentPluginVersionCallsStateDBTriggersRebuild ( )

Definition at line 542 of file ilArtifactComponentRepositoryTest.php.

542 : void
543 {
544 $VERSION = $this->data_factory->version("1000.0.0");
545 $DB_VERSION = 1000;
546
547 $plugin_state_db = $this->createStub(ilPluginStateDB::class);
549 public int $build_called = 0;
550 protected function buildDatabase(): void
551 {
552 $this->build_called++;
553 parent::buildDatabase();
554 }
555 protected function readComponentData(): array
556 {
557 return ["mod1" => ["components/ILIAS", "Module1", [["slt1", "Slot1"]]]];
558 }
559 protected function readPluginData(): array
560 {
561 return [
562 "plg1" => [
563 "components/ILIAS",
564 "Module1",
565 "Slot1",
566 "Plugin1",
567 "1.9.1",
568 "8.0",
569 "8.999",
570 "Richard Klees",
571 "richard.klees@concepts-and-training.de",
572 true,
573 false,
574 null
575 ]
576 ];
577 }
578 };
579
580 $this->assertEquals(1, $db->build_called);
581
582 $db->setCurrentPluginVersion("plg1", $VERSION, $DB_VERSION);
583
584 $this->assertEquals(2, $db->build_called);
585 }

References $data_factory, $db, $ilias_version, $plugin_state_db, and ilArtifactComponentRepository\setCurrentPluginVersion().

+ Here is the call graph for this function:

◆ testUnknownPlugin()

ilArtifactComponentRepositoryTest::testUnknownPlugin ( )

Definition at line 424 of file ilArtifactComponentRepositoryTest.php.

424 : void
425 {
426 $this->expectException(\InvalidArgumentException::class);
427 $this->db->getPluginById("some_id");
428 }

◆ testUsesPluginStateDB()

ilArtifactComponentRepositoryTest::testUsesPluginStateDB ( )

Definition at line 430 of file ilArtifactComponentRepositoryTest.php.

430 : void
431 {
432 $plugin_state_db = $this->createMock(ilPluginStateDB::class);
433 $plugin_state_db->expects($this->once())
434 ->method("isPluginActivated")
435 ->with("plg1")
436 ->willReturn(true);
437 $plugin_state_db->expects($this->once())
438 ->method("getCurrentPluginVersion")
439 ->with("plg1")
440 ->willReturn($this->data_factory->version("1.8.0"));
441 $plugin_state_db->expects($this->once())
442 ->method("getCurrentPluginDBVersion")
443 ->with("plg1")
444 ->willReturn(42);
445
447 protected function readComponentData(): array
448 {
449 return ["mod1" => ["components/ILIAS", "Module1", [["slt1", "Slot1"]]]];
450 }
451 protected function readPluginData(): array
452 {
453 return [
454 "plg1" => [
455 "components/ILIAS",
456 "Module1",
457 "Slot1",
458 "Plugin1",
459 "1.9.1",
460 "8.0",
461 "8.999",
462 "Richard Klees",
463 "richard.klees@concepts-and-training.de",
464 true,
465 false,
466 null
467 ]
468 ];
469 }
470 };
471
472 $plugin = $db->getPluginById("plg1");
473 $this->assertTrue($plugin->isActivated());
474 $this->assertEquals(
475 $this->data_factory->version("1.8.0"),
476 $plugin->getCurrentVersion()
477 );
478 $this->assertEquals(42, $plugin->getCurrentDBVersion());
479 }

References $data_factory, $db, $ilias_version, XapiProxy\$plugin, $plugin_state_db, and ilArtifactComponentRepository\getPluginById().

+ Here is the call graph for this function:

Field Documentation

◆ $component_data

array ilArtifactComponentRepositoryTest::$component_data
static
Initial value:
= [
"mod1" => ["components/ILIAS", "Module1", [
["slt1", "Slot1"],
["slt2", "Slot2"],
]],
"mod2" => ["components/ILIAS", "Module2", [
]],
"ser1" => ["components/ILIAS", "Service1", [
["slt3", "Slot3"]
]],
"ser2" => ["components/ILIAS", "Service2", [
["slt4", "Slot4"]
]]
]

Definition at line 24 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $data_factory

◆ $db

◆ $ilias_version

◆ $mod1

ilComponentInfo ilArtifactComponentRepositoryTest::$mod1
protected

Definition at line 91 of file ilArtifactComponentRepositoryTest.php.

◆ $mod2

ilComponentInfo ilArtifactComponentRepositoryTest::$mod2
protected

Definition at line 95 of file ilArtifactComponentRepositoryTest.php.

◆ $plg1

ilPluginInfo ilArtifactComponentRepositoryTest::$plg1
protected

◆ $plg2

ilPluginInfo ilArtifactComponentRepositoryTest::$plg2
protected

Definition at line 100 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plg3

ilPluginInfo ilArtifactComponentRepositoryTest::$plg3
protected

Definition at line 101 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plugin_data

array ilArtifactComponentRepositoryTest::$plugin_data
static

Definition at line 39 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plugin_state_db

◆ $ser1

ilComponentInfo ilArtifactComponentRepositoryTest::$ser1
protected

Definition at line 96 of file ilArtifactComponentRepositoryTest.php.

◆ $ser2

ilComponentInfo ilArtifactComponentRepositoryTest::$ser2
protected

Definition at line 98 of file ilArtifactComponentRepositoryTest.php.

◆ $slt1

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt1
protected

Definition at line 92 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt2

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt2
protected

Definition at line 94 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt3

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt3
protected

Definition at line 97 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt4

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt4
protected

Definition at line 99 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().


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