ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilCertificateBaseTestCase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
24 abstract class ilCertificateBaseTestCase extends TestCase
25 {
26  protected ?Container $dic;
27 
28  protected function setUp(): void
29  {
30  if (!defined('ANONYMOUS_USER_ID')) {
31  define('ANONYMOUS_USER_ID', 13);
32  }
33 
34  global $DIC;
35 
36  $this->dic = is_object($DIC) ? clone $DIC : $DIC;
37 
38  $DIC = new Container();
39 
40  parent::setUp();
41  }
42 
43  protected function setGlobalVariable(string $name, mixed $value): void
44  {
45  global $DIC;
46 
47  $GLOBALS[$name] = $value;
48 
49  unset($DIC[$name]);
50  $DIC[$name] = static function (Container $c) use ($name) {
51  return $GLOBALS[$name];
52  };
53  }
54 }
setGlobalVariable(string $name, mixed $value)
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:26