ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilBuddySystemBaseTestCase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
24 class 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 
43  $DIC = $this->dic;
44 
45  parent::tearDown();
46  }
47 
51  protected function setGlobalVariable(string $name, $value): void
52  {
53  global $DIC;
54 
55  $GLOBALS[$name] = $value;
56 
57  unset($DIC[$name]);
58  $DIC[$name] = static function ($c) use ($name) {
59  return $GLOBALS[$name];
60  };
61  }
62 }
$c
Definition: deliver.php:9
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
setGlobalVariable(string $name, $value)
$GLOBALS["DIC"]
Definition: wac.php:30
global $DIC
Definition: shib_login.php:25