ILIAS  release_7 Revision v7.30-3-g800a261c036
ConfigCollectionTest.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5namespace ILIAS\Tests\Setup;
6
8use PHPUnit\Framework\TestCase;
9
10class ConfigCollectionTest extends TestCase
11{
12 use Helper;
13
14 public function testConstruct() : void
15 {
16 $c1 = $this->newConfig();
17 $c2 = $this->newConfig();
18 $c3 = $this->newConfig();
19
20 $c = new Setup\ConfigCollection(["c1" => $c1, "c2" => $c2, "c3" => $c3]);
21
22 $this->assertInstanceOf(Setup\Config::class, $c);
23 }
24
25 public function testGetConfig() : void
26 {
27 $c1 = $this->newConfig();
28 $c2 = $this->newConfig();
29 $c3 = $this->newConfig();
30
31 $c = new Setup\ConfigCollection(["c1" => $c1, "c2" => $c2, "c3" => $c3]);
32
33 $this->assertEquals($c1, $c->getConfig("c1"));
34 $this->assertEquals($c2, $c->getConfig("c2"));
35 $this->assertEquals($c3, $c->getConfig("c3"));
36 }
37
38 public function testGetKeys() : void
39 {
40 $c1 = $this->newConfig();
41 $c2 = $this->newConfig();
42 $c3 = $this->newConfig();
43
44 $c = new Setup\ConfigCollection(["c1" => $c1, "c2" => $c2, "c3" => $c3]);
45
46 $this->assertEquals(["c1", "c2", "c3"], $c->getKeys());
47 }
48
49 public function testMaybeGetConfig() : void
50 {
51 $c1 = $this->newConfig();
52 $c2 = $this->newConfig();
53 $c3 = $this->newConfig();
54
55 $c = new Setup\ConfigCollection(["c1" => $c1, "c2" => $c2]);
56
57 $this->assertEquals($c1, $c->maybeGetConfig("c1"));
58 $this->assertEquals($c2, $c->maybeGetConfig("c2"));
59 $this->assertEquals(null, $c->maybeGetConfig("c3"));
60 }
61}
An exception for terminatinating execution or to throw for unit testing.
A collection of some configurations.
$c
Definition: cli.php:37
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...