ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 => ["components/ILIAS"
 
static array Module2
 
static array ser1 => ["components/ILIAS"
 
static array Service1
 
static array ser2 => ["components/ILIAS"
 
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 ()
 

Protected Attributes

Data Factory $data_factory
 
Data Version $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 23 of file ilArtifactComponentRepositoryTest.php.

Member Function Documentation

◆ setUp()

ilArtifactComponentRepositoryTest::setUp ( )
protected

Definition at line 101 of file ilArtifactComponentRepositoryTest.php.

References $component_data, $data_factory, $id, $ilias_version, $plg1, $plg2, $plg3, $plugin_data, $plugin_state_db, $slt1, $slt2, $slt3, $slt4, $version, false, mod2, plg2, plg3, ser1, ser2, and true.

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

◆ testCallBuildDatabaseTwice()

ilArtifactComponentRepositoryTest::testCallBuildDatabaseTwice ( )

Definition at line 585 of file ilArtifactComponentRepositoryTest.php.

References plg2.

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

◆ testGetComponentById()

ilArtifactComponentRepositoryTest::testGetComponentById ( )

Definition at line 319 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

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

◆ testGetComponentByIdTypeThrowsOnInvalidId()

ilArtifactComponentRepositoryTest::testGetComponentByIdTypeThrowsOnInvalidId ( )

Definition at line 347 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetComponentByTypeAndName()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndName ( )

Definition at line 327 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

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

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent1()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent1 ( )

Definition at line 335 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent2()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent2 ( )

Definition at line 341 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetComponents()

ilArtifactComponentRepositoryTest::testGetComponents ( )

Definition at line 302 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, ser2, and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

302  : void
303  {
304  $result = iterator_to_array($this->db->getComponents());
305 
306  $ids = array_keys($result);
307  $expected_ids = ["mod1", "mod2", "ser1", "ser2"];
308  sort($ids);
309  sort($expected_ids);
310 
311  $this->assertEquals($expected_ids, $ids);
312 
313  $this->assertEquals($this->mod1, $result["mod1"]);
314  $this->assertEquals($this->mod2, $result["mod2"]);
315  $this->assertEquals($this->ser1, $result["ser1"]);
316  $this->assertEquals($this->ser2, $result["ser2"]);
317  }
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:25
+ Here is the call graph for this function:

◆ testGetPluginById()

ilArtifactComponentRepositoryTest::testGetPluginById ( )

Definition at line 410 of file ilArtifactComponentRepositoryTest.php.

References plg2.

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

◆ testGetPluginByName()

ilArtifactComponentRepositoryTest::testGetPluginByName ( )

Definition at line 416 of file ilArtifactComponentRepositoryTest.php.

References plg2.

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

◆ testGetPlugins()

ilArtifactComponentRepositoryTest::testGetPlugins ( )

Definition at line 395 of file ilArtifactComponentRepositoryTest.php.

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

395  : void
396  {
397  $plugins = iterator_to_array($this->db->getPlugins());
398 
399  $ids = array_keys($plugins);
400  $expected_ids = ["plg1", "plg2", "plg3"];
401  sort($ids);
402  sort($expected_ids);
403 
404  $this->assertEquals($expected_ids, $ids);
405 
406  $this->assertEquals($this->plg1, $plugins["plg1"]);
407  $this->assertEquals($this->plg2, $plugins["plg2"]);
408  }
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:25
+ Here is the call graph for this function:

◆ testGetPluginslotById()

ilArtifactComponentRepositoryTest::testGetPluginslotById ( )

Definition at line 370 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetPluginSlots()

ilArtifactComponentRepositoryTest::testGetPluginSlots ( )

Definition at line 353 of file ilArtifactComponentRepositoryTest.php.

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

353  : void
354  {
355  $slots = iterator_to_array($this->db->getPluginSlots());
356 
357  $ids = array_keys($slots);
358  $expected_ids = ["slt1", "slt2", "slt3", "slt4"];
359  sort($ids);
360  sort($expected_ids);
361 
362  $this->assertEquals($expected_ids, $ids);
363 
364  $this->assertEquals($this->slt1, $slots["slt1"]);
365  $this->assertEquals($this->slt2, $slots["slt2"]);
366  $this->assertEquals($this->slt3, $slots["slt3"]);
367  $this->assertEquals($this->slt4, $slots["slt4"]);
368  }
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:25
+ Here is the call graph for this function:

◆ testGetPluginViaComponentAndPluginSlot()

ilArtifactComponentRepositoryTest::testGetPluginViaComponentAndPluginSlot ( )

Definition at line 479 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasActivatedPlugin()

ilArtifactComponentRepositoryTest::testHasActivatedPlugin ( )

Definition at line 760 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasComponent()

ilArtifactComponentRepositoryTest::testHasComponent ( )

Definition at line 272 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasComponentId()

ilArtifactComponentRepositoryTest::testHasComponentId ( )

Definition at line 290 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasComponentThrowsOnUnknownType()

ilArtifactComponentRepositoryTest::testHasComponentThrowsOnUnknownType ( )

Definition at line 284 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasPluginId()

ilArtifactComponentRepositoryTest::testHasPluginId ( )

Definition at line 754 of file ilArtifactComponentRepositoryTest.php.

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

◆ testNoPluginSlot()

ilArtifactComponentRepositoryTest::testNoPluginSlot ( )

Definition at line 378 of file ilArtifactComponentRepositoryTest.php.

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

378  : void
379  {
381  protected function readComponentData(): array
382  {
383  return ["mod2" => ["components/ILIAS", "Module2", []]];
384  }
385  protected function readPluginData(): array
386  {
387  return [];
388  }
389  };
390 
391  $slots = iterator_to_array($db->getPluginSlots());
392  $this->assertEquals([], $slots);
393  }
Repository for component data implemented over artifacts.
+ Here is the call graph for this function:

◆ testRemoveStateInformationOfCallsStateDB()

ilArtifactComponentRepositoryTest::testRemoveStateInformationOfCallsStateDB ( )

Definition at line 675 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testRemoveStateInformationOfTriggersRebuild()

ilArtifactComponentRepositoryTest::testRemoveStateInformationOfTriggersRebuild ( )

Definition at line 712 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testSetActivationCallsStateDB()

ilArtifactComponentRepositoryTest::testSetActivationCallsStateDB ( )

Definition at line 596 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testSetActivationTriggersRebuild()

ilArtifactComponentRepositoryTest::testSetActivationTriggersRebuild ( )

Definition at line 633 of file ilArtifactComponentRepositoryTest.php.

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

633  : void
634  {
635  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
637  public int $build_called = 0;
638  protected function buildDatabase(): void
639  {
640  $this->build_called++;
641  parent::buildDatabase();
642  }
643  protected function readComponentData(): array
644  {
645  return ["mod1" => ["components/ILIAS", "Module1", [["slt1", "Slot1"]]]];
646  }
647  protected function readPluginData(): array
648  {
649  return [
650  "plg1" => [
651  "components/ILIAS",
652  "Module1",
653  "Slot1",
654  "Plugin1",
655  "1.9.1",
656  "8.0",
657  "8.999",
658  "Richard Klees",
659  "richard.klees@concepts-and-training.de",
660  true,
661  false,
662  null
663  ]
664  ];
665  }
666  };
667 
668  $this->assertEquals(1, $db->build_called);
669 
670  $db->setActivation("plg1", false);
671 
672  $this->assertEquals(2, $db->build_called);
673  }
static array static array Richard richard klees concepts and training null
setActivation(string $plugin_id, bool $activated)
Repository for component data implemented over artifacts.
+ Here is the call graph for this function:

◆ testSetCurrentPluginVersionCallsStateDB()

ilArtifactComponentRepositoryTest::testSetCurrentPluginVersionCallsStateDB ( )

Definition at line 489 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testSetCurrentPluginVersionCallsStateDBTriggersRebuild()

ilArtifactComponentRepositoryTest::testSetCurrentPluginVersionCallsStateDBTriggersRebuild ( )

Definition at line 540 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testUnknownPlugin()

ilArtifactComponentRepositoryTest::testUnknownPlugin ( )

Definition at line 422 of file ilArtifactComponentRepositoryTest.php.

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

◆ testUsesPluginStateDB()

ilArtifactComponentRepositoryTest::testUsesPluginStateDB ( )

Definition at line 428 of file ilArtifactComponentRepositoryTest.php.

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

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

Definition at line 25 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $data_factory

◆ $db

ilArtifactComponentRepository ilArtifactComponentRepositoryTest::$db
protected

Definition at line 88 of file ilArtifactComponentRepositoryTest.php.

◆ $ilias_version

◆ $mod1

ilComponentInfo ilArtifactComponentRepositoryTest::$mod1
protected

Definition at line 89 of file ilArtifactComponentRepositoryTest.php.

◆ $mod2

ilComponentInfo ilArtifactComponentRepositoryTest::$mod2
protected

Definition at line 93 of file ilArtifactComponentRepositoryTest.php.

◆ $plg1

ilPluginInfo ilArtifactComponentRepositoryTest::$plg1
protected

Definition at line 91 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plg2

ilPluginInfo ilArtifactComponentRepositoryTest::$plg2
protected

Definition at line 98 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plg3

ilPluginInfo ilArtifactComponentRepositoryTest::$plg3
protected

Definition at line 99 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plugin_data

array static array ilArtifactComponentRepositoryTest::$plugin_data
static
Initial value:
= [
"plg1" => [
"Type1",
"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().

◆ $plugin_state_db

◆ $ser1

ilComponentInfo ilArtifactComponentRepositoryTest::$ser1
protected

Definition at line 94 of file ilArtifactComponentRepositoryTest.php.

◆ $ser2

ilComponentInfo ilArtifactComponentRepositoryTest::$ser2
protected

Definition at line 96 of file ilArtifactComponentRepositoryTest.php.

◆ $slt1

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt1
protected

Definition at line 90 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt2

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt2
protected

Definition at line 92 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt3

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt3
protected

Definition at line 95 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt4

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt4
protected

Definition at line 97 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 => ["components/ILIAS"
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

◆ plg3

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

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 => ["components/ILIAS"
static

◆ ser2

array ilArtifactComponentRepositoryTest::ser2 => ["components/ILIAS"
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: