ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 mod2 => ["Modules"
 
static array Module2
 
static array ser1 => ["Services"
 
static array Service1
 
static array ser2 => ["Services"
 
static array Service2
 
static array static array $plugin_data
 
static array static array plg2
 
static array static array Service2
 
static array static array Slot4
 
static array static array Plugin2
 
static array static array Richard Klees
 
static array static array Richard richard klees concepts and training de
 
static array static array Richard richard klees concepts and training null
 
static array static array Richard richard klees concepts and training true
 
static array static array Richard richard klees concepts and training false
 
static array static array Richard richard klees concepts and training plg3
 
static array static array Richard richard klees concepts and training Service2
 
static array static array Richard richard klees concepts and training Slot4
 
static array static array Richard richard klees concepts and training Plugin3
 
static array static array Richard richard klees concepts and training Richard Klees
 
static array static array Richard richard klees concepts and training Richard richard klees concepts and training de
 
static array static array Richard richard klees concepts and training Richard richard klees concepts and training null
 
static array static array Richard richard klees concepts and training Richard richard klees concepts and training true
 
static array static array Richard richard klees concepts and training Richard richard klees concepts and training false
 

Protected Member Functions

 setUp ()
 

Detailed Description

Definition at line 23 of file ilArtifactComponentRepositoryTest.php.

Member Function Documentation

◆ setUp()

ilArtifactComponentRepositoryTest::setUp ( )
protected

Definition at line 85 of file ilArtifactComponentRepositoryTest.php.

References $component_data, $id, $plugin_data, $version, false, mod2, plg2, plg3, ser1, ser2, and true.

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

◆ testCallBuildDatabaseTwice()

ilArtifactComponentRepositoryTest::testCallBuildDatabaseTwice ( )

Definition at line 566 of file ilArtifactComponentRepositoryTest.php.

References plg2.

566  : void
567  {
568  $this->db->_buildDatabase();
569 
570  $this->assertEquals($this->mod1, $this->db->getComponentById("mod1"));
571  $this->assertEquals($this->mod1, $this->db->getComponentByTypeAndName("Modules", "Module1"));
572  $this->assertEquals($this->slt1, $this->db->getPluginSlotById("slt1"));
573  $this->assertEquals($this->plg1, $this->db->getPluginById("plg1"));
574  $this->assertEquals($this->plg2, $this->db->getPluginByName("Plugin2"));
575  }

◆ testGetComponentById()

ilArtifactComponentRepositoryTest::testGetComponentById ( )

Definition at line 300 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

300  : void
301  {
302  $this->assertEquals($this->mod1, $this->db->getComponentById("mod1"));
303  $this->assertEquals($this->mod2, $this->db->getComponentById("mod2"));
304  $this->assertEquals($this->ser1, $this->db->getComponentById("ser1"));
305  $this->assertEquals($this->ser2, $this->db->getComponentById("ser2"));
306  }

◆ testGetComponentByIdTypeThrowsOnInvalidId()

ilArtifactComponentRepositoryTest::testGetComponentByIdTypeThrowsOnInvalidId ( )

Definition at line 328 of file ilArtifactComponentRepositoryTest.php.

328  : void
329  {
330  $this->expectException(\InvalidArgumentException::class);
331  $this->db->getComponentById("some_id");
332  }

◆ testGetComponentByTypeAndName()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndName ( )

Definition at line 308 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

308  : void
309  {
310  $this->assertEquals($this->mod1, $this->db->getComponentByTypeAndName("Modules", "Module1"));
311  $this->assertEquals($this->mod2, $this->db->getComponentByTypeAndName("Modules", "Module2"));
312  $this->assertEquals($this->ser1, $this->db->getComponentByTypeAndName("Services", "Service1"));
313  $this->assertEquals($this->ser2, $this->db->getComponentByTypeAndName("Services", "Service2"));
314  }

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent1()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent1 ( )

Definition at line 316 of file ilArtifactComponentRepositoryTest.php.

316  : void
317  {
318  $this->expectException(\InvalidArgumentException::class);
319  $this->db->getComponentByTypeAndName("Modules", "Module3");
320  }

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent2()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent2 ( )

Definition at line 322 of file ilArtifactComponentRepositoryTest.php.

322  : void
323  {
324  $this->expectException(\InvalidArgumentException::class);
325  $this->db->getComponentByTypeAndName("OtherComponent", "Service1");
326  }

◆ testGetComponents()

ilArtifactComponentRepositoryTest::testGetComponents ( )

Definition at line 283 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

283  : void
284  {
285  $result = iterator_to_array($this->db->getComponents());
286 
287  $ids = array_keys($result);
288  $expected_ids = ["mod1", "mod2", "ser1", "ser2"];
289  sort($ids);
290  sort($expected_ids);
291 
292  $this->assertEquals($expected_ids, $ids);
293 
294  $this->assertEquals($this->mod1, $result["mod1"]);
295  $this->assertEquals($this->mod2, $result["mod2"]);
296  $this->assertEquals($this->ser1, $result["ser1"]);
297  $this->assertEquals($this->ser2, $result["ser2"]);
298  }

◆ testGetPluginById()

ilArtifactComponentRepositoryTest::testGetPluginById ( )

Definition at line 391 of file ilArtifactComponentRepositoryTest.php.

References plg2.

391  : void
392  {
393  $this->assertEquals($this->plg1, $this->db->getPluginById("plg1"));
394  $this->assertEquals($this->plg2, $this->db->getPluginById("plg2"));
395  }

◆ testGetPluginByName()

ilArtifactComponentRepositoryTest::testGetPluginByName ( )

Definition at line 397 of file ilArtifactComponentRepositoryTest.php.

References plg2.

397  : void
398  {
399  $this->assertEquals($this->plg1, $this->db->getPluginByName("Plugin1"));
400  $this->assertEquals($this->plg2, $this->db->getPluginByName("Plugin2"));
401  }

◆ testGetPlugins()

ilArtifactComponentRepositoryTest::testGetPlugins ( )

Definition at line 376 of file ilArtifactComponentRepositoryTest.php.

References plg2.

376  : void
377  {
378  $plugins = iterator_to_array($this->db->getPlugins());
379 
380  $ids = array_keys($plugins);
381  $expected_ids = ["plg1", "plg2", "plg3"];
382  sort($ids);
383  sort($expected_ids);
384 
385  $this->assertEquals($expected_ids, $ids);
386 
387  $this->assertEquals($this->plg1, $plugins["plg1"]);
388  $this->assertEquals($this->plg2, $plugins["plg2"]);
389  }

◆ testGetPluginslotById()

ilArtifactComponentRepositoryTest::testGetPluginslotById ( )

Definition at line 351 of file ilArtifactComponentRepositoryTest.php.

351  : void
352  {
353  $this->assertEquals($this->slt1, $this->db->getPluginSlotById("slt1"));
354  $this->assertEquals($this->slt2, $this->db->getPluginSlotById("slt2"));
355  $this->assertEquals($this->slt3, $this->db->getPluginSlotById("slt3"));
356  $this->assertEquals($this->slt4, $this->db->getPluginSlotById("slt4"));
357  }

◆ testGetPluginSlots()

ilArtifactComponentRepositoryTest::testGetPluginSlots ( )

Definition at line 334 of file ilArtifactComponentRepositoryTest.php.

334  : void
335  {
336  $slots = iterator_to_array($this->db->getPluginSlots());
337 
338  $ids = array_keys($slots);
339  $expected_ids = ["slt1", "slt2", "slt3", "slt4"];
340  sort($ids);
341  sort($expected_ids);
342 
343  $this->assertEquals($expected_ids, $ids);
344 
345  $this->assertEquals($this->slt1, $slots["slt1"]);
346  $this->assertEquals($this->slt2, $slots["slt2"]);
347  $this->assertEquals($this->slt3, $slots["slt3"]);
348  $this->assertEquals($this->slt4, $slots["slt4"]);
349  }

◆ testGetPluginViaComponentAndPluginSlot()

ilArtifactComponentRepositoryTest::testGetPluginViaComponentAndPluginSlot ( )

Definition at line 460 of file ilArtifactComponentRepositoryTest.php.

460  : void
461  {
462  $plg1 = $this->db
463  ->getComponentByTypeAndName("Modules", "Module1")
464  ->getPluginSlotById("slt1")
465  ->getPluginById("plg1");
466 
467  $this->assertEquals($this->plg1, $plg1);
468  }

◆ testHasActivatedPlugin()

ilArtifactComponentRepositoryTest::testHasActivatedPlugin ( )

Definition at line 741 of file ilArtifactComponentRepositoryTest.php.

741  : void
742  {
743  $this->assertFalse($this->db->hasActivatedPlugin("plg1")); // exists, but is not activated
744  $this->assertFalse($this->db->hasActivatedPlugin("plg666")); // does not exist
745  $this->assertTrue($this->db->hasActivatedPlugin("plg3")); // exists and is activated
746  }

◆ testHasComponent()

ilArtifactComponentRepositoryTest::testHasComponent ( )

Definition at line 253 of file ilArtifactComponentRepositoryTest.php.

253  : void
254  {
255  $this->assertTrue($this->db->hasComponent("Modules", "Module1"));
256  $this->assertTrue($this->db->hasComponent("Modules", "Module2"));
257  $this->assertTrue($this->db->hasComponent("Services", "Service1"));
258  $this->assertTrue($this->db->hasComponent("Services", "Service2"));
259  $this->assertFalse($this->db->hasComponent("Modules", "Module3"));
260  $this->assertFalse($this->db->hasComponent("Modules", "Module4"));
261  $this->assertFalse($this->db->hasComponent("Services", "Service3"));
262  $this->assertFalse($this->db->hasComponent("Services", "Service4"));
263  }

◆ testHasComponentId()

ilArtifactComponentRepositoryTest::testHasComponentId ( )

Definition at line 271 of file ilArtifactComponentRepositoryTest.php.

271  : void
272  {
273  $this->assertTrue($this->db->hasComponentId("mod1"));
274  $this->assertTrue($this->db->hasComponentId("mod2"));
275  $this->assertTrue($this->db->hasComponentId("ser1"));
276  $this->assertTrue($this->db->hasComponentId("ser2"));
277  $this->assertFalse($this->db->hasComponentId("mod3"));
278  $this->assertFalse($this->db->hasComponentId("mod4"));
279  $this->assertFalse($this->db->hasComponentId("ser3"));
280  $this->assertFalse($this->db->hasComponentId("ser4"));
281  }

◆ testHasComponentThrowsOnUnknownType()

ilArtifactComponentRepositoryTest::testHasComponentThrowsOnUnknownType ( )

Definition at line 265 of file ilArtifactComponentRepositoryTest.php.

265  : void
266  {
267  $this->expectException(\InvalidArgumentException::class);
268  $this->db->hasComponent("OtherComponent", "Module1");
269  }

◆ testHasPluginId()

ilArtifactComponentRepositoryTest::testHasPluginId ( )

Definition at line 735 of file ilArtifactComponentRepositoryTest.php.

735  : void
736  {
737  $this->assertTrue($this->db->hasPluginId("plg1"));
738  $this->assertFalse($this->db->hasPluginId("plg666"));
739  }

◆ testNoPluginSlot()

ilArtifactComponentRepositoryTest::testNoPluginSlot ( )

Definition at line 359 of file ilArtifactComponentRepositoryTest.php.

359  : void
360  {
361  $db = new class ($this->data_factory, $this->plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
362  protected function readComponentData(): array
363  {
364  return ["mod2" => ["Modules", "Module2", []]];
365  }
366  protected function readPluginData(): array
367  {
368  return [];
369  }
370  };
371 
372  $slots = iterator_to_array($db->getPluginSlots());
373  $this->assertEquals([], $slots);
374  }
Repository for component data implemented over artifacts.

◆ testRemoveStateInformationOfCallsStateDB()

ilArtifactComponentRepositoryTest::testRemoveStateInformationOfCallsStateDB ( )

Definition at line 656 of file ilArtifactComponentRepositoryTest.php.

References null.

656  : void
657  {
658  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
659 
660  $db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
661  protected function readComponentData(): array
662  {
663  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
664  }
665  protected function readPluginData(): array
666  {
667  return [
668  "plg1" => [
669  "Modules",
670  "Module1",
671  "Slot1",
672  "Plugin1",
673  "1.9.1",
674  "8.0",
675  "8.999",
676  "Richard Klees",
677  "richard.klees@concepts-and-training.de",
678  true,
679  false,
680  null
681  ]
682  ];
683  }
684  };
685 
686  $plugin_state_db->expects($this->once())
687  ->method("remove")
688  ->with("plg1");
689 
690  $db->removeStateInformationOf("plg1");
691  }
static array static array Richard richard klees concepts and training null
Repository for component data implemented over artifacts.

◆ testRemoveStateInformationOfTriggersRebuild()

ilArtifactComponentRepositoryTest::testRemoveStateInformationOfTriggersRebuild ( )

Definition at line 693 of file ilArtifactComponentRepositoryTest.php.

References null.

693  : void
694  {
695  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
696  $db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
697  public int $build_called = 0;
698  protected function buildDatabase(): void
699  {
700  $this->build_called++;
701  parent::buildDatabase();
702  }
703  protected function readComponentData(): array
704  {
705  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
706  }
707  protected function readPluginData(): array
708  {
709  return [
710  "plg1" => [
711  "Modules",
712  "Module1",
713  "Slot1",
714  "Plugin1",
715  "1.9.1",
716  "8.0",
717  "8.999",
718  "Richard Klees",
719  "richard.klees@concepts-and-training.de",
720  true,
721  false,
722  null
723  ]
724  ];
725  }
726  };
727 
728  $this->assertEquals(1, $db->build_called);
729 
730  $db->removeStateInformationOf("plg1");
731 
732  $this->assertEquals(2, $db->build_called);
733  }
static array static array Richard richard klees concepts and training null
Repository for component data implemented over artifacts.

◆ testSetActivationCallsStateDB()

ilArtifactComponentRepositoryTest::testSetActivationCallsStateDB ( )

Definition at line 577 of file ilArtifactComponentRepositoryTest.php.

References null.

577  : void
578  {
579  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
580 
581  $db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
582  protected function readComponentData(): array
583  {
584  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
585  }
586  protected function readPluginData(): array
587  {
588  return [
589  "plg1" => [
590  "Modules",
591  "Module1",
592  "Slot1",
593  "Plugin1",
594  "1.9.1",
595  "8.0",
596  "8.999",
597  "Richard Klees",
598  "richard.klees@concepts-and-training.de",
599  true,
600  false,
601  null
602  ]
603  ];
604  }
605  };
606 
607  $plugin_state_db->expects($this->once())
608  ->method("setActivation")
609  ->with("plg1", true);
610 
611  $db->setActivation("plg1", true);
612  }
static array static array Richard richard klees concepts and training null
Repository for component data implemented over artifacts.

◆ testSetActivationTriggersRebuild()

ilArtifactComponentRepositoryTest::testSetActivationTriggersRebuild ( )

Definition at line 614 of file ilArtifactComponentRepositoryTest.php.

References null.

614  : void
615  {
616  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
617  $db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
618  public int $build_called = 0;
619  protected function buildDatabase(): void
620  {
621  $this->build_called++;
622  parent::buildDatabase();
623  }
624  protected function readComponentData(): array
625  {
626  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
627  }
628  protected function readPluginData(): array
629  {
630  return [
631  "plg1" => [
632  "Modules",
633  "Module1",
634  "Slot1",
635  "Plugin1",
636  "1.9.1",
637  "8.0",
638  "8.999",
639  "Richard Klees",
640  "richard.klees@concepts-and-training.de",
641  true,
642  false,
643  null
644  ]
645  ];
646  }
647  };
648 
649  $this->assertEquals(1, $db->build_called);
650 
651  $db->setActivation("plg1", false);
652 
653  $this->assertEquals(2, $db->build_called);
654  }
static array static array Richard richard klees concepts and training null
Repository for component data implemented over artifacts.

◆ testSetCurrentPluginVersionCallsStateDB()

ilArtifactComponentRepositoryTest::testSetCurrentPluginVersionCallsStateDB ( )

Definition at line 470 of file ilArtifactComponentRepositoryTest.php.

References null.

470  : void
471  {
472  $VERSION = $this->data_factory->version("1000.0.0");
473  $DB_VERSION = 1000;
474 
475  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
476  $plugin_state_db
477  ->method("isPluginActivated")
478  ->with("plg1")
479  ->willReturn(true);
480  $plugin_state_db
481  ->method("getCurrentPluginVersion")
482  ->with("plg1")
483  ->willReturn($this->data_factory->version("1.8.0"));
484  $plugin_state_db
485  ->method("getCurrentPluginDBVersion")
486  ->with("plg1")
487  ->willReturn(42);
488  $plugin_state_db->expects($this->once())
489  ->method("setCurrentPluginVersion")
490  ->with("plg1", $VERSION, $DB_VERSION);
491 
492  $db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
493  protected function readComponentData(): array
494  {
495  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
496  }
497  protected function readPluginData(): array
498  {
499  return [
500  "plg1" => [
501  "Modules",
502  "Module1",
503  "Slot1",
504  "Plugin1",
505  "1.9.1",
506  "8.0",
507  "8.999",
508  "Richard Klees",
509  "richard.klees@concepts-and-training.de",
510  true,
511  false,
512  null
513  ]
514  ];
515  }
516  };
517 
518  $db->setCurrentPluginVersion("plg1", $VERSION, $DB_VERSION);
519  }
static array static array Richard richard klees concepts and training null
Repository for component data implemented over artifacts.

◆ testSetCurrentPluginVersionCallsStateDBTriggersRebuild()

ilArtifactComponentRepositoryTest::testSetCurrentPluginVersionCallsStateDBTriggersRebuild ( )

Definition at line 521 of file ilArtifactComponentRepositoryTest.php.

References null.

521  : void
522  {
523  $VERSION = $this->data_factory->version("1000.0.0");
524  $DB_VERSION = 1000;
525 
526  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
527  $db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
528  public int $build_called = 0;
529  protected function buildDatabase(): void
530  {
531  $this->build_called++;
532  parent::buildDatabase();
533  }
534  protected function readComponentData(): array
535  {
536  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
537  }
538  protected function readPluginData(): array
539  {
540  return [
541  "plg1" => [
542  "Modules",
543  "Module1",
544  "Slot1",
545  "Plugin1",
546  "1.9.1",
547  "8.0",
548  "8.999",
549  "Richard Klees",
550  "richard.klees@concepts-and-training.de",
551  true,
552  false,
553  null
554  ]
555  ];
556  }
557  };
558 
559  $this->assertEquals(1, $db->build_called);
560 
561  $db->setCurrentPluginVersion("plg1", $VERSION, $DB_VERSION);
562 
563  $this->assertEquals(2, $db->build_called);
564  }
static array static array Richard richard klees concepts and training null
Repository for component data implemented over artifacts.

◆ testUnknownPlugin()

ilArtifactComponentRepositoryTest::testUnknownPlugin ( )

Definition at line 403 of file ilArtifactComponentRepositoryTest.php.

403  : void
404  {
405  $this->expectException(\InvalidArgumentException::class);
406  $this->db->getPluginById("some_id");
407  }

◆ testUsesPluginStateDB()

ilArtifactComponentRepositoryTest::testUsesPluginStateDB ( )

Definition at line 409 of file ilArtifactComponentRepositoryTest.php.

References XapiProxy\$plugin, and null.

409  : void
410  {
411  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
412  $plugin_state_db->expects($this->once())
413  ->method("isPluginActivated")
414  ->with("plg1")
415  ->willReturn(true);
416  $plugin_state_db->expects($this->once())
417  ->method("getCurrentPluginVersion")
418  ->with("plg1")
419  ->willReturn($this->data_factory->version("1.8.0"));
420  $plugin_state_db->expects($this->once())
421  ->method("getCurrentPluginDBVersion")
422  ->with("plg1")
423  ->willReturn(42);
424 
425  $db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
426  protected function readComponentData(): array
427  {
428  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
429  }
430  protected function readPluginData(): array
431  {
432  return [
433  "plg1" => [
434  "Modules",
435  "Module1",
436  "Slot1",
437  "Plugin1",
438  "1.9.1",
439  "8.0",
440  "8.999",
441  "Richard Klees",
442  "richard.klees@concepts-and-training.de",
443  true,
444  false,
445  null
446  ]
447  ];
448  }
449  };
450 
451  $plugin = $db->getPluginById("plg1");
452  $this->assertTrue($plugin->isActivated());
453  $this->assertEquals(
454  $this->data_factory->version("1.8.0"),
455  $plugin->getCurrentVersion()
456  );
457  $this->assertEquals(42, $plugin->getCurrentDBVersion());
458  }
static array static array Richard richard klees concepts and training null
Repository for component data implemented over artifacts.

Field Documentation

◆ $component_data

array ilArtifactComponentRepositoryTest::$component_data
static
Initial value:
= [
"mod1" => ["Modules", "Module1", [
["slt1", "Slot1"],
["slt2", "Slot2"],
]]

Definition at line 25 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plugin_data

array static array ilArtifactComponentRepositoryTest::$plugin_data
static
Initial value:
= [
"plg1" => [
"Modules",
"Module1",
"Slot1",
"Plugin1",
"1.9.1",
"8.0",
"8.999",
"Richard Klees",
"richard.klees@concepts-and-training.de",
true,
false,
]

Definition at line 40 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ de [1/2]

array static array Richard richard klees concepts and training ilArtifactComponentRepositoryTest::de
static

Definition at line 55 of file ilArtifactComponentRepositoryTest.php.

◆ de [2/2]

array static array Richard richard klees concepts and training Richard richard klees concepts and training ilArtifactComponentRepositoryTest::de
static

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.

◆ false [1/2]

array static array Richard richard klees concepts and training ilArtifactComponentRepositoryTest::false
static

Definition at line 55 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ false [2/2]

array static array Richard richard klees concepts and training Richard richard klees concepts and training ilArtifactComponentRepositoryTest::false
static

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.

◆ Klees [1/2]

array static array Richard ilArtifactComponentRepositoryTest::Klees
static

Definition at line 55 of file ilArtifactComponentRepositoryTest.php.

◆ Klees [2/2]

array static array Richard richard klees concepts and training Richard ilArtifactComponentRepositoryTest::Klees
static

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.

◆ mod2

array ilArtifactComponentRepositoryTest::mod2 => ["Modules"
static

◆ Module2

array ilArtifactComponentRepositoryTest::Module2
static

Definition at line 30 of file ilArtifactComponentRepositoryTest.php.

◆ null [1/2]

◆ null [2/2]

array static array Richard richard klees concepts and training Richard richard klees concepts and training ilArtifactComponentRepositoryTest::null
static

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.

◆ plg2

array static array ilArtifactComponentRepositoryTest::plg2
static
Initial value:
=> [
"Services"

Definition at line 55 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp(), testCallBuildDatabaseTwice(), testGetPluginById(), testGetPluginByName(), and testGetPlugins().

◆ plg3

array static array Richard richard klees concepts and training ilArtifactComponentRepositoryTest::plg3
static
Initial value:
=> [
"Services"

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ Plugin2

array static array ilArtifactComponentRepositoryTest::Plugin2
static

Definition at line 55 of file ilArtifactComponentRepositoryTest.php.

◆ Plugin3

array static array Richard richard klees concepts and training ilArtifactComponentRepositoryTest::Plugin3
static

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.

◆ ser1

array ilArtifactComponentRepositoryTest::ser1 => ["Services"
static

◆ ser2

array ilArtifactComponentRepositoryTest::ser2 => ["Services"
static

◆ Service1

array ilArtifactComponentRepositoryTest::Service1
static

Definition at line 32 of file ilArtifactComponentRepositoryTest.php.

◆ Service2 [1/3]

array ilArtifactComponentRepositoryTest::Service2
static

Definition at line 35 of file ilArtifactComponentRepositoryTest.php.

◆ Service2 [2/3]

array static array ilArtifactComponentRepositoryTest::Service2
static

Definition at line 55 of file ilArtifactComponentRepositoryTest.php.

◆ Service2 [3/3]

array static array Richard richard klees concepts and training ilArtifactComponentRepositoryTest::Service2
static

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.

◆ Slot4 [1/2]

array static array ilArtifactComponentRepositoryTest::Slot4
static

Definition at line 55 of file ilArtifactComponentRepositoryTest.php.

◆ Slot4 [2/2]

array static array Richard richard klees concepts and training ilArtifactComponentRepositoryTest::Slot4
static

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.

◆ true [1/2]

array static array Richard richard klees concepts and training ilArtifactComponentRepositoryTest::true
static

Definition at line 55 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ true [2/2]

array static array Richard richard klees concepts and training Richard richard klees concepts and training ilArtifactComponentRepositoryTest::true
static

Definition at line 69 of file ilArtifactComponentRepositoryTest.php.


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