ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ConfigCollectionTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\Tests\Setup;
22 
23 use ILIAS\Setup;
25 
26 class ConfigCollectionTest extends TestCase
27 {
28  use Helper;
29 
30  public function testConstruct(): void
31  {
32  $c1 = $this->newConfig();
33  $c2 = $this->newConfig();
34  $c3 = $this->newConfig();
35 
36  $c = new Setup\ConfigCollection(["c1" => $c1, "c2" => $c2, "c3" => $c3]);
37 
38  $this->assertInstanceOf(Setup\Config::class, $c);
39  }
40 
41  public function testGetConfig(): void
42  {
43  $c1 = $this->newConfig();
44  $c2 = $this->newConfig();
45  $c3 = $this->newConfig();
46 
47  $c = new Setup\ConfigCollection(["c1" => $c1, "c2" => $c2, "c3" => $c3]);
48 
49  $this->assertEquals($c1, $c->getConfig("c1"));
50  $this->assertEquals($c2, $c->getConfig("c2"));
51  $this->assertEquals($c3, $c->getConfig("c3"));
52  }
53 
54  public function testGetKeys(): void
55  {
56  $c1 = $this->newConfig();
57  $c2 = $this->newConfig();
58  $c3 = $this->newConfig();
59 
60  $c = new Setup\ConfigCollection(["c1" => $c1, "c2" => $c2, "c3" => $c3]);
61 
62  $this->assertEquals(["c1", "c2", "c3"], $c->getKeys());
63  }
64 
65  public function testMaybeGetConfig(): void
66  {
67  $c1 = $this->newConfig();
68  $c2 = $this->newConfig();
69  $c3 = $this->newConfig();
70 
71  $c = new Setup\ConfigCollection(["c1" => $c1, "c2" => $c2]);
72 
73  $this->assertEquals($c1, $c->maybeGetConfig("c1"));
74  $this->assertEquals($c2, $c->maybeGetConfig("c2"));
75  $this->assertEquals(null, $c->maybeGetConfig("c3"));
76  }
77 }
$c
Definition: cli.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A collection of some configurations.