ILIAS  release_8 Revision v8.23
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 
55  protected function setGlobalVariable(string $name, $value): void
56  {
57  global $DIC;
58 
59  $GLOBALS[$name] = $value;
60 
61  unset($DIC[$name]);
62  $DIC[$name] = static function ($c) use ($name) {
63  return $GLOBALS[$name];
64  };
65  }
66 }
$c
Definition: cli.php:38
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
setGlobalVariable(string $name, $value)