ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLogComponentLevelTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
23
29class ilLogComponentLevelTest extends TestCase
30{
31 protected Container $dic;
32
33 protected function setUp(): void
34 {
35 $this->initDependencies();
36 parent::setUp();
37 }
38
39 public function testLevel(): void
40 {
41 $component_level = new ilLogComponentLevel(
42 'log',
44 );
45 $this->assertEquals('log', $component_level->getComponentId());
46 $this->assertEquals(ilLogLevel::CRITICAL, $component_level->getLevel());
47 }
48
49
50 protected function setGlobalVariable(string $name, $value): void
51 {
52 global $DIC;
53
54 $GLOBALS[$name] = $value;
55 unset($DIC[$name]);
56 $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
57 return $value;
58 };
59 }
60
61 protected function initDependencies(): void
62 {
63 $this->dic = new Container();
64 $GLOBALS['DIC'] = $this->dic;
65 $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
66 }
67}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Unit tests for class ilDidacticTemplate.
setGlobalVariable(string $name, $value)
individual log levels for components
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54