ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 

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
 

Detailed Description

Definition at line 23 of file ilArtifactComponentRepositoryTest.php.

Member Function Documentation

◆ setUp()

ilArtifactComponentRepositoryTest::setUp ( )
protected

Definition at line 100 of file ilArtifactComponentRepositoryTest.php.

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

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

References plg2.

581  : void
582  {
583  $this->db->_buildDatabase();
584 
585  $this->assertEquals($this->mod1, $this->db->getComponentById("mod1"));
586  $this->assertEquals($this->mod1, $this->db->getComponentByTypeAndName("Modules", "Module1"));
587  $this->assertEquals($this->slt1, $this->db->getPluginSlotById("slt1"));
588  $this->assertEquals($this->plg1, $this->db->getPluginById("plg1"));
589  $this->assertEquals($this->plg2, $this->db->getPluginByName("Plugin2"));
590  }

◆ testGetComponentById()

ilArtifactComponentRepositoryTest::testGetComponentById ( )

Definition at line 315 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

315  : void
316  {
317  $this->assertEquals($this->mod1, $this->db->getComponentById("mod1"));
318  $this->assertEquals($this->mod2, $this->db->getComponentById("mod2"));
319  $this->assertEquals($this->ser1, $this->db->getComponentById("ser1"));
320  $this->assertEquals($this->ser2, $this->db->getComponentById("ser2"));
321  }

◆ testGetComponentByIdTypeThrowsOnInvalidId()

ilArtifactComponentRepositoryTest::testGetComponentByIdTypeThrowsOnInvalidId ( )

Definition at line 343 of file ilArtifactComponentRepositoryTest.php.

343  : void
344  {
345  $this->expectException(\InvalidArgumentException::class);
346  $this->db->getComponentById("some_id");
347  }

◆ testGetComponentByTypeAndName()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndName ( )

Definition at line 323 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

323  : void
324  {
325  $this->assertEquals($this->mod1, $this->db->getComponentByTypeAndName("Modules", "Module1"));
326  $this->assertEquals($this->mod2, $this->db->getComponentByTypeAndName("Modules", "Module2"));
327  $this->assertEquals($this->ser1, $this->db->getComponentByTypeAndName("Services", "Service1"));
328  $this->assertEquals($this->ser2, $this->db->getComponentByTypeAndName("Services", "Service2"));
329  }

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent1()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent1 ( )

Definition at line 331 of file ilArtifactComponentRepositoryTest.php.

331  : void
332  {
333  $this->expectException(\InvalidArgumentException::class);
334  $this->db->getComponentByTypeAndName("Modules", "Module3");
335  }

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent2()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent2 ( )

Definition at line 337 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetComponents()

ilArtifactComponentRepositoryTest::testGetComponents ( )

Definition at line 298 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

298  : void
299  {
300  $result = iterator_to_array($this->db->getComponents());
301 
302  $ids = array_keys($result);
303  $expected_ids = ["mod1", "mod2", "ser1", "ser2"];
304  sort($ids);
305  sort($expected_ids);
306 
307  $this->assertEquals($expected_ids, $ids);
308 
309  $this->assertEquals($this->mod1, $result["mod1"]);
310  $this->assertEquals($this->mod2, $result["mod2"]);
311  $this->assertEquals($this->ser1, $result["ser1"]);
312  $this->assertEquals($this->ser2, $result["ser2"]);
313  }

◆ testGetPluginById()

ilArtifactComponentRepositoryTest::testGetPluginById ( )

Definition at line 406 of file ilArtifactComponentRepositoryTest.php.

References plg2.

406  : void
407  {
408  $this->assertEquals($this->plg1, $this->db->getPluginById("plg1"));
409  $this->assertEquals($this->plg2, $this->db->getPluginById("plg2"));
410  }

◆ testGetPluginByName()

ilArtifactComponentRepositoryTest::testGetPluginByName ( )

Definition at line 412 of file ilArtifactComponentRepositoryTest.php.

References plg2.

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

◆ testGetPlugins()

ilArtifactComponentRepositoryTest::testGetPlugins ( )

Definition at line 391 of file ilArtifactComponentRepositoryTest.php.

References plg2.

391  : void
392  {
393  $plugins = iterator_to_array($this->db->getPlugins());
394 
395  $ids = array_keys($plugins);
396  $expected_ids = ["plg1", "plg2", "plg3"];
397  sort($ids);
398  sort($expected_ids);
399 
400  $this->assertEquals($expected_ids, $ids);
401 
402  $this->assertEquals($this->plg1, $plugins["plg1"]);
403  $this->assertEquals($this->plg2, $plugins["plg2"]);
404  }

◆ testGetPluginslotById()

ilArtifactComponentRepositoryTest::testGetPluginslotById ( )

Definition at line 366 of file ilArtifactComponentRepositoryTest.php.

366  : void
367  {
368  $this->assertEquals($this->slt1, $this->db->getPluginSlotById("slt1"));
369  $this->assertEquals($this->slt2, $this->db->getPluginSlotById("slt2"));
370  $this->assertEquals($this->slt3, $this->db->getPluginSlotById("slt3"));
371  $this->assertEquals($this->slt4, $this->db->getPluginSlotById("slt4"));
372  }

◆ testGetPluginSlots()

ilArtifactComponentRepositoryTest::testGetPluginSlots ( )

Definition at line 349 of file ilArtifactComponentRepositoryTest.php.

349  : void
350  {
351  $slots = iterator_to_array($this->db->getPluginSlots());
352 
353  $ids = array_keys($slots);
354  $expected_ids = ["slt1", "slt2", "slt3", "slt4"];
355  sort($ids);
356  sort($expected_ids);
357 
358  $this->assertEquals($expected_ids, $ids);
359 
360  $this->assertEquals($this->slt1, $slots["slt1"]);
361  $this->assertEquals($this->slt2, $slots["slt2"]);
362  $this->assertEquals($this->slt3, $slots["slt3"]);
363  $this->assertEquals($this->slt4, $slots["slt4"]);
364  }

◆ testGetPluginViaComponentAndPluginSlot()

ilArtifactComponentRepositoryTest::testGetPluginViaComponentAndPluginSlot ( )

Definition at line 475 of file ilArtifactComponentRepositoryTest.php.

475  : void
476  {
477  $plg1 = $this->db
478  ->getComponentByTypeAndName("Modules", "Module1")
479  ->getPluginSlotById("slt1")
480  ->getPluginById("plg1");
481 
482  $this->assertEquals($this->plg1, $plg1);
483  }

◆ testHasActivatedPlugin()

ilArtifactComponentRepositoryTest::testHasActivatedPlugin ( )

Definition at line 756 of file ilArtifactComponentRepositoryTest.php.

756  : void
757  {
758  $this->assertFalse($this->db->hasActivatedPlugin("plg1")); // exists, but is not activated
759  $this->assertFalse($this->db->hasActivatedPlugin("plg666")); // does not exist
760  $this->assertTrue($this->db->hasActivatedPlugin("plg3")); // exists and is activated
761  }

◆ testHasComponent()

ilArtifactComponentRepositoryTest::testHasComponent ( )

Definition at line 268 of file ilArtifactComponentRepositoryTest.php.

268  : void
269  {
270  $this->assertTrue($this->db->hasComponent("Modules", "Module1"));
271  $this->assertTrue($this->db->hasComponent("Modules", "Module2"));
272  $this->assertTrue($this->db->hasComponent("Services", "Service1"));
273  $this->assertTrue($this->db->hasComponent("Services", "Service2"));
274  $this->assertFalse($this->db->hasComponent("Modules", "Module3"));
275  $this->assertFalse($this->db->hasComponent("Modules", "Module4"));
276  $this->assertFalse($this->db->hasComponent("Services", "Service3"));
277  $this->assertFalse($this->db->hasComponent("Services", "Service4"));
278  }

◆ testHasComponentId()

ilArtifactComponentRepositoryTest::testHasComponentId ( )

Definition at line 286 of file ilArtifactComponentRepositoryTest.php.

286  : void
287  {
288  $this->assertTrue($this->db->hasComponentId("mod1"));
289  $this->assertTrue($this->db->hasComponentId("mod2"));
290  $this->assertTrue($this->db->hasComponentId("ser1"));
291  $this->assertTrue($this->db->hasComponentId("ser2"));
292  $this->assertFalse($this->db->hasComponentId("mod3"));
293  $this->assertFalse($this->db->hasComponentId("mod4"));
294  $this->assertFalse($this->db->hasComponentId("ser3"));
295  $this->assertFalse($this->db->hasComponentId("ser4"));
296  }

◆ testHasComponentThrowsOnUnknownType()

ilArtifactComponentRepositoryTest::testHasComponentThrowsOnUnknownType ( )

Definition at line 280 of file ilArtifactComponentRepositoryTest.php.

280  : void
281  {
282  $this->expectException(\InvalidArgumentException::class);
283  $this->db->hasComponent("OtherComponent", "Module1");
284  }

◆ testHasPluginId()

ilArtifactComponentRepositoryTest::testHasPluginId ( )

Definition at line 750 of file ilArtifactComponentRepositoryTest.php.

750  : void
751  {
752  $this->assertTrue($this->db->hasPluginId("plg1"));
753  $this->assertFalse($this->db->hasPluginId("plg666"));
754  }

◆ testNoPluginSlot()

ilArtifactComponentRepositoryTest::testNoPluginSlot ( )

Definition at line 374 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testRemoveStateInformationOfCallsStateDB()

ilArtifactComponentRepositoryTest::testRemoveStateInformationOfCallsStateDB ( )

Definition at line 671 of file ilArtifactComponentRepositoryTest.php.

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

671  : void
672  {
673  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
674 
676  protected function readComponentData(): array
677  {
678  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
679  }
680  protected function readPluginData(): array
681  {
682  return [
683  "plg1" => [
684  "Modules",
685  "Module1",
686  "Slot1",
687  "Plugin1",
688  "1.9.1",
689  "8.0",
690  "8.999",
691  "Richard Klees",
692  "richard.klees@concepts-and-training.de",
693  true,
694  false,
695  null
696  ]
697  ];
698  }
699  };
700 
701  $plugin_state_db->expects($this->once())
702  ->method("remove")
703  ->with("plg1");
704 
705  $db->removeStateInformationOf("plg1");
706  }
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 708 of file ilArtifactComponentRepositoryTest.php.

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

708  : void
709  {
710  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
712  public int $build_called = 0;
713  protected function buildDatabase(): void
714  {
715  $this->build_called++;
716  parent::buildDatabase();
717  }
718  protected function readComponentData(): array
719  {
720  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
721  }
722  protected function readPluginData(): array
723  {
724  return [
725  "plg1" => [
726  "Modules",
727  "Module1",
728  "Slot1",
729  "Plugin1",
730  "1.9.1",
731  "8.0",
732  "8.999",
733  "Richard Klees",
734  "richard.klees@concepts-and-training.de",
735  true,
736  false,
737  null
738  ]
739  ];
740  }
741  };
742 
743  $this->assertEquals(1, $db->build_called);
744 
745  $db->removeStateInformationOf("plg1");
746 
747  $this->assertEquals(2, $db->build_called);
748  }
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 592 of file ilArtifactComponentRepositoryTest.php.

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

592  : void
593  {
594  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
595 
597  protected function readComponentData(): array
598  {
599  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
600  }
601  protected function readPluginData(): array
602  {
603  return [
604  "plg1" => [
605  "Modules",
606  "Module1",
607  "Slot1",
608  "Plugin1",
609  "1.9.1",
610  "8.0",
611  "8.999",
612  "Richard Klees",
613  "richard.klees@concepts-and-training.de",
614  true,
615  false,
616  null
617  ]
618  ];
619  }
620  };
621 
622  $plugin_state_db->expects($this->once())
623  ->method("setActivation")
624  ->with("plg1", true);
625 
626  $db->setActivation("plg1", true);
627  }
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 629 of file ilArtifactComponentRepositoryTest.php.

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

629  : void
630  {
631  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
633  public int $build_called = 0;
634  protected function buildDatabase(): void
635  {
636  $this->build_called++;
637  parent::buildDatabase();
638  }
639  protected function readComponentData(): array
640  {
641  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
642  }
643  protected function readPluginData(): array
644  {
645  return [
646  "plg1" => [
647  "Modules",
648  "Module1",
649  "Slot1",
650  "Plugin1",
651  "1.9.1",
652  "8.0",
653  "8.999",
654  "Richard Klees",
655  "richard.klees@concepts-and-training.de",
656  true,
657  false,
658  null
659  ]
660  ];
661  }
662  };
663 
664  $this->assertEquals(1, $db->build_called);
665 
666  $db->setActivation("plg1", false);
667 
668  $this->assertEquals(2, $db->build_called);
669  }
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 485 of file ilArtifactComponentRepositoryTest.php.

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

485  : void
486  {
487  $VERSION = $this->data_factory->version("1000.0.0");
488  $DB_VERSION = 1000;
489 
490  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
492  ->method("isPluginActivated")
493  ->with("plg1")
494  ->willReturn(true);
496  ->method("getCurrentPluginVersion")
497  ->with("plg1")
498  ->willReturn($this->data_factory->version("1.8.0"));
500  ->method("getCurrentPluginDBVersion")
501  ->with("plg1")
502  ->willReturn(42);
503  $plugin_state_db->expects($this->once())
504  ->method("setCurrentPluginVersion")
505  ->with("plg1", $VERSION, $DB_VERSION);
506 
508  protected function readComponentData(): array
509  {
510  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
511  }
512  protected function readPluginData(): array
513  {
514  return [
515  "plg1" => [
516  "Modules",
517  "Module1",
518  "Slot1",
519  "Plugin1",
520  "1.9.1",
521  "8.0",
522  "8.999",
523  "Richard Klees",
524  "richard.klees@concepts-and-training.de",
525  true,
526  false,
527  null
528  ]
529  ];
530  }
531  };
532 
533  $db->setCurrentPluginVersion("plg1", $VERSION, $DB_VERSION);
534  }
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 536 of file ilArtifactComponentRepositoryTest.php.

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

536  : void
537  {
538  $VERSION = $this->data_factory->version("1000.0.0");
539  $DB_VERSION = 1000;
540 
541  $plugin_state_db = $this->createMock(ilPluginStateDB::class);
543  public int $build_called = 0;
544  protected function buildDatabase(): void
545  {
546  $this->build_called++;
547  parent::buildDatabase();
548  }
549  protected function readComponentData(): array
550  {
551  return ["mod1" => ["Modules", "Module1", [["slt1", "Slot1"]]]];
552  }
553  protected function readPluginData(): array
554  {
555  return [
556  "plg1" => [
557  "Modules",
558  "Module1",
559  "Slot1",
560  "Plugin1",
561  "1.9.1",
562  "8.0",
563  "8.999",
564  "Richard Klees",
565  "richard.klees@concepts-and-training.de",
566  true,
567  false,
568  null
569  ]
570  ];
571  }
572  };
573 
574  $this->assertEquals(1, $db->build_called);
575 
576  $db->setCurrentPluginVersion("plg1", $VERSION, $DB_VERSION);
577 
578  $this->assertEquals(2, $db->build_called);
579  }
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 418 of file ilArtifactComponentRepositoryTest.php.

418  : void
419  {
420  $this->expectException(\InvalidArgumentException::class);
421  $this->db->getPluginById("some_id");
422  }

◆ testUsesPluginStateDB()

ilArtifactComponentRepositoryTest::testUsesPluginStateDB ( )

Definition at line 424 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ $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().

◆ $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 => ["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: