ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBuddySystemBaseTestCase.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use PHPUnit\Framework\TestCase;
23
24class ilBuddySystemBaseTestCase extends TestCase
25{
26 private ?Container $dic = null;
27
28 protected function setUp(): void
29 {
30 global $DIC;
31
32 parent::setUp();
33
34 $this->dic = is_object($DIC) ? clone $DIC : $DIC;
35
36 $DIC = new Container();
37 }
38
39 protected function tearDown(): void
40 {
41 global $DIC;
42
44
45 parent::tearDown();
46 }
47
48 protected function setGlobalVariable(string $name, mixed $value): void
49 {
50 global $DIC;
51
52 $GLOBALS[$name] = $value;
53
54 unset($DIC[$name]);
55 $DIC[$name] = static fn($c) => $GLOBALS[$name];
56 }
57}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
setGlobalVariable(string $name, mixed $value)
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54