ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilBuddySystemBaseTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
27 class ilBuddySystemBaseTest extends TestCase
28 {
29  private ?Container $dic = null;
30 
31  protected function setUp(): void
32  {
33  global $DIC;
34 
35  parent::setUp();
36 
37  $this->dic = is_object($DIC) ? clone $DIC : $DIC;
38 
39  $DIC = new Container();
40  }
41 
42  protected function tearDown(): void
43  {
44  global $DIC;
45 
46  $DIC = $this->dic;
47 
48  parent::tearDown();
49  }
50 
54  protected function setGlobalVariable(string $name, $value): void
55  {
56  global $DIC;
57 
58  $GLOBALS[$name] = $value;
59 
60  unset($DIC[$name]);
61  $DIC[$name] = static function ($c) use ($name) {
62  return $GLOBALS[$name];
63  };
64  }
65 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
global $DIC
Definition: feed.php:28
$GLOBALS["DIC"]
Definition: wac.php:31
setGlobalVariable(string $name, $value)