ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilADTFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
7 
12 class ilADTFactoryTest extends TestCase
13 {
14  protected $backupGlobals = false;
15 
16  protected Container $dic;
17 
18  protected function setUp(): void
19  {
20  $this->initDependencies();
21  parent::setUp();
22  }
23 
24  public function testConstruct(): void
25  {
26  $first = ilADTFactory::getInstance();
27  $second = ilADTFactory::getInstance();
28  $this->assertEquals($first, $second);
29  }
30 
31  protected function setGlobalVariable(string $name, $value): void
32  {
33  global $DIC;
34 
35  $GLOBALS[$name] = $value;
36  unset($DIC[$name]);
37  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
38  return $value;
39  };
40  }
41 
42  protected function initDependencies(): void
43  {
44  $this->dic = new Container();
45  $GLOBALS['DIC'] = $this->dic;
46  }
47 }
$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
Unit tests for class ilADTFactory.