ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ConfigReaderTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Tests\Setup\CLI;
22
23use ILIAS\Setup;
24use PHPUnit\Framework\TestCase;
25
26class ConfigReaderTest extends TestCase
27{
28 public function testReadConfigFile(): void
29 {
30 $filename = tempnam("/tmp", "ILIAS");
31 $expected = [
32 "some" => [
33 "nested" => "config"
34 ]
35 ];
36 file_put_contents($filename, json_encode($expected));
37 $obj = new Setup\CLI\ConfigReader();
38
39 $config = $obj->readConfigFile($filename);
40
41 $this->assertEquals($expected, $config);
42 }
43
44 public function testBaseDir(): void
45 {
46 $filename = tempnam("/tmp", "ILIAS");
47 $expected = [
48 "some" => [
49 "nested" => "config"
50 ]
51 ];
52 file_put_contents($filename, json_encode($expected));
53
54 $obj = new Setup\CLI\ConfigReader("/tmp");
55
56 $config = $obj->readConfigFile(basename($filename));
57
58 $this->assertEquals($expected, $config);
59 }
60
61 public function testTotalDir(): void
62 {
63 $filename = tempnam("/tmp", "ILIAS");
64 $expected = [
65 "some" => [
66 "nested" => "config"
67 ]
68 ];
69 file_put_contents($filename, json_encode($expected));
70
71 $obj = new Setup\CLI\ConfigReader("/foo");
72
73 $config = $obj->readConfigFile($filename);
74
75 $this->assertEquals($expected, $config);
76 }
77}
$filename
Definition: buildRTE.php:78
Read a json-formatted config from a file and overwrite some fields.
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...