ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
TypedIniFileTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23use PHPUnit\Framework\TestCase;
24
29final class TypedIniFileTest extends TestCase
30{
31 private string $file;
32
33 protected function setUp(): void
34 {
35 $this->file = tempnam(sys_get_temp_dir(), 'ini_typed_');
36 file_put_contents(
37 $this->file,
38 "; <?php exit; ?>\n"
39 . "[server]\n"
40 . "absolute_path = \"/var/www/ilias\"\n"
41 . "\n"
42 . "[db]\n"
43 . "type = \"innodb\"\n"
44 );
45 }
46
47 protected function tearDown(): void
48 {
49 if (is_file($this->file)) {
50 unlink($this->file);
51 }
52 }
53
55 {
56 $ini = new IliasIniFile($this->file);
57
58 self::assertSame('/var/www/ilias', $ini->getAbsolutePath());
59 self::assertFalse($ini->isAutoHttpsDetectEnabled());
60 self::assertSame('', $ini->getAutoHttpsDetectHeaderName());
61 self::assertSame('', $ini->getAutoHttpsDetectHeaderValue());
62 }
63
65 {
66 $ini = new ClientIniFile($this->file);
67
68 self::assertSame('innodb', $ini->getDatabaseType());
69 self::assertSame('', $ini->getClientName());
70 self::assertSame(0, $ini->getRootFolderId());
71 }
72}
Ini files of older installations lack keys added later; the typed accessors read them as empty,...
testIliasIniWithoutHttpsSectionReadsAsDisabled()