ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCertificateBaseTestCase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
28 abstract class ilCertificateBaseTestCase extends TestCase
29 {
30  protected ?Container $dic;
31 
32  protected function setUp(): void
33  {
34  if (!defined('ANONYMOUS_USER_ID')) {
35  define('ANONYMOUS_USER_ID', 13);
36  }
37 
38  global $DIC;
39 
40  $this->dic = is_object($DIC) ? clone $DIC : $DIC;
41 
42  $DIC = new Container();
43 
44  parent::setUp();
45  }
46 
50  protected function setGlobalVariable(string $name, $value): void
51  {
52  global $DIC;
53 
54  $GLOBALS[$name] = $value;
55 
56  unset($DIC[$name]);
57  $DIC[$name] = static function (Container $c) use ($name) {
58  return $GLOBALS[$name];
59  };
60  }
61 }
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
Class ilCertificateBaseTestCase.
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:22
setGlobalVariable(string $name, $value)