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