ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 => ["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 22 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, $plg3, $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  "components/ILIAS",
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  "Type1",
167  false,
168  $this->data_factory->version("0.9.1"),
169  13,
170  $this->data_factory->version("1.9.1"),
171  $this->data_factory->version("8.0"),
172  $this->data_factory->version("8.999"),
173  "Richard Klees",
174  "richard.klees@concepts-and-training.de",
175  true,
176  false,
177  true
178  );
179  $plugins1["plg1"] = $this->plg1;
180  $plugins2 = [];
181  $this->slt2 = new ilPluginSlotInfo(
182  $this->mod1,
183  "slt2",
184  "Slot2",
185  $plugins2
186  );
187  $slots1 = ["slt1" => $this->slt1, "slt2" => $this->slt2];
188 
189  $slots2 = [];
190  $this->mod2 = new ilComponentInfo(
191  "mod2",
192  "components/ILIAS",
193  "Module2",
194  $slots2
195  );
196 
197  $slots3 = [];
198  $this->ser1 = new ilComponentInfo(
199  "ser1",
200  "components/ILIAS",
201  "Service1",
202  $slots3
203  );
204 
205  $plugins3 = [];
206  $this->slt3 = new ilPluginSlotInfo(
207  $this->ser1,
208  "slt3",
209  "Slot3",
210  $plugins3
211  );
212  $slots3 = ["slt3" => $this->slt3];
213 
214  $slots4 = [];
215  $this->ser2 = new ilComponentInfo(
216  "ser2",
217  "components/ILIAS",
218  "Service2",
219  $slots4
220  );
221  $plugins4 = [];
222  $this->slt4 = new ilPluginSlotInfo(
223  $this->ser2,
224  "slt4",
225  "Slot4",
226  $plugins4
227  );
228  $slots4 = ["slt4" => $this->slt4];
229 
230  $this->plg2 = new ilPluginInfo(
231  $this->ilias_version,
232  $this->slt4,
233  "plg2",
234  "Plugin2",
235  "Type2",
236  false,
237  $this->data_factory->version("0.9.1"),
238  13,
239  $this->data_factory->version("2.9.1"),
240  $this->data_factory->version("8.1"),
241  $this->data_factory->version("8.999"),
242  "Richard Klees",
243  "richard.klees@concepts-and-training.de",
244  false,
245  true,
246  false
247  );
248  $plugins4["plg2"] = $this->plg2;
249 
250  $this->plg3 = new ilPluginInfo(
251  $this->ilias_version,
252  $this->slt4,
253  "plg3",
254  "Plugin3",
255  "Type3",
256  true,
257  $this->data_factory->version("0.9.1"),
258  13,
259  $this->data_factory->version("2.9.2"),
260  $this->data_factory->version("8.1"),
261  $this->data_factory->version("8.999"),
262  "Richard Klees",
263  "richard.klees@concepts-and-training.de",
264  false,
265  true,
266  false
267  );
268  $plugins4["plg3"] = $this->plg3;
269  }
static array static array Richard richard klees concepts and training true
$version
Definition: plugin.php:24
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:23
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 584 of file ilArtifactComponentRepositoryTest.php.

References plg2.

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

◆ testGetComponentById()

ilArtifactComponentRepositoryTest::testGetComponentById ( )

Definition at line 318 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

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

◆ testGetComponentByIdTypeThrowsOnInvalidId()

ilArtifactComponentRepositoryTest::testGetComponentByIdTypeThrowsOnInvalidId ( )

Definition at line 346 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetComponentByTypeAndName()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndName ( )

Definition at line 326 of file ilArtifactComponentRepositoryTest.php.

References mod2, ser1, and ser2.

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

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent1()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent1 ( )

Definition at line 334 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetComponentByTypeAndNameThrowsOnUnknownComponent2()

ilArtifactComponentRepositoryTest::testGetComponentByTypeAndNameThrowsOnUnknownComponent2 ( )

Definition at line 340 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetComponents()

ilArtifactComponentRepositoryTest::testGetComponents ( )

Definition at line 301 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testGetPluginById()

ilArtifactComponentRepositoryTest::testGetPluginById ( )

Definition at line 409 of file ilArtifactComponentRepositoryTest.php.

References plg2.

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

◆ testGetPluginByName()

ilArtifactComponentRepositoryTest::testGetPluginByName ( )

Definition at line 415 of file ilArtifactComponentRepositoryTest.php.

References plg2.

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

◆ testGetPlugins()

ilArtifactComponentRepositoryTest::testGetPlugins ( )

Definition at line 394 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testGetPluginslotById()

ilArtifactComponentRepositoryTest::testGetPluginslotById ( )

Definition at line 369 of file ilArtifactComponentRepositoryTest.php.

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

◆ testGetPluginSlots()

ilArtifactComponentRepositoryTest::testGetPluginSlots ( )

Definition at line 352 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testGetPluginViaComponentAndPluginSlot()

ilArtifactComponentRepositoryTest::testGetPluginViaComponentAndPluginSlot ( )

Definition at line 478 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasActivatedPlugin()

ilArtifactComponentRepositoryTest::testHasActivatedPlugin ( )

Definition at line 759 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasComponent()

ilArtifactComponentRepositoryTest::testHasComponent ( )

Definition at line 271 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasComponentId()

ilArtifactComponentRepositoryTest::testHasComponentId ( )

Definition at line 289 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasComponentThrowsOnUnknownType()

ilArtifactComponentRepositoryTest::testHasComponentThrowsOnUnknownType ( )

Definition at line 283 of file ilArtifactComponentRepositoryTest.php.

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

◆ testHasPluginId()

ilArtifactComponentRepositoryTest::testHasPluginId ( )

Definition at line 753 of file ilArtifactComponentRepositoryTest.php.

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

◆ testNoPluginSlot()

ilArtifactComponentRepositoryTest::testNoPluginSlot ( )

Definition at line 377 of file ilArtifactComponentRepositoryTest.php.

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

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

◆ testRemoveStateInformationOfCallsStateDB()

ilArtifactComponentRepositoryTest::testRemoveStateInformationOfCallsStateDB ( )

Definition at line 674 of file ilArtifactComponentRepositoryTest.php.

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

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

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

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

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

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

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

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

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

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

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

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

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

◆ testUsesPluginStateDB()

ilArtifactComponentRepositoryTest::testUsesPluginStateDB ( )

Definition at line 427 of file ilArtifactComponentRepositoryTest.php.

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

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

Referenced by setUp().

◆ $data_factory

◆ $db

ilArtifactComponentRepository ilArtifactComponentRepositoryTest::$db
protected

Definition at line 87 of file ilArtifactComponentRepositoryTest.php.

◆ $ilias_version

◆ $mod1

ilComponentInfo ilArtifactComponentRepositoryTest::$mod1
protected

Definition at line 88 of file ilArtifactComponentRepositoryTest.php.

◆ $mod2

ilComponentInfo ilArtifactComponentRepositoryTest::$mod2
protected

Definition at line 92 of file ilArtifactComponentRepositoryTest.php.

◆ $plg1

ilPluginInfo ilArtifactComponentRepositoryTest::$plg1
protected

Definition at line 90 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plg2

ilPluginInfo ilArtifactComponentRepositoryTest::$plg2
protected

Definition at line 97 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plg3

ilPluginInfo ilArtifactComponentRepositoryTest::$plg3
protected

Definition at line 98 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 39 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $plugin_state_db

◆ $ser1

ilComponentInfo ilArtifactComponentRepositoryTest::$ser1
protected

Definition at line 93 of file ilArtifactComponentRepositoryTest.php.

◆ $ser2

ilComponentInfo ilArtifactComponentRepositoryTest::$ser2
protected

Definition at line 95 of file ilArtifactComponentRepositoryTest.php.

◆ $slt1

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt1
protected

Definition at line 89 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt2

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt2
protected

Definition at line 91 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt3

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt3
protected

Definition at line 94 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ $slt4

ilPluginSlotInfo ilArtifactComponentRepositoryTest::$slt4
protected

Definition at line 96 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 54 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 68 of file ilArtifactComponentRepositoryTest.php.

◆ false [1/2]

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

Definition at line 54 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 68 of file ilArtifactComponentRepositoryTest.php.

◆ Klees [1/2]

array static array Richard ilArtifactComponentRepositoryTest::Klees
static

Definition at line 54 of file ilArtifactComponentRepositoryTest.php.

◆ Klees [2/2]

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

Definition at line 68 of file ilArtifactComponentRepositoryTest.php.

◆ mod2

array ilArtifactComponentRepositoryTest::mod2 => ["components/ILIAS"
static

◆ Module2

array ilArtifactComponentRepositoryTest::Module2
static

Definition at line 29 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 68 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 68 of file ilArtifactComponentRepositoryTest.php.

Referenced by setUp().

◆ Plugin2

array static array ilArtifactComponentRepositoryTest::Plugin2
static

Definition at line 54 of file ilArtifactComponentRepositoryTest.php.

◆ Plugin3

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

Definition at line 68 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 31 of file ilArtifactComponentRepositoryTest.php.

◆ Service2 [1/3]

array ilArtifactComponentRepositoryTest::Service2
static

Definition at line 34 of file ilArtifactComponentRepositoryTest.php.

◆ Service2 [2/3]

array static array ilArtifactComponentRepositoryTest::Service2
static

Definition at line 54 of file ilArtifactComponentRepositoryTest.php.

◆ Service2 [3/3]

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

Definition at line 68 of file ilArtifactComponentRepositoryTest.php.

◆ Slot4 [1/2]

array static array ilArtifactComponentRepositoryTest::Slot4
static

Definition at line 54 of file ilArtifactComponentRepositoryTest.php.

◆ Slot4 [2/2]

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

Definition at line 68 of file ilArtifactComponentRepositoryTest.php.

◆ true [1/2]

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

Definition at line 54 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 68 of file ilArtifactComponentRepositoryTest.php.


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