ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilADTFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
28 class ilADTFactoryTest extends TestCase
29 {
30  protected $backupGlobals = false;
31 
32  protected Container $dic;
33 
34  protected function setUp(): void
35  {
36  $this->initDependencies();
37  parent::setUp();
38  }
39 
40  public function testConstruct(): void
41  {
42  $first = ilADTFactory::getInstance();
43  $second = ilADTFactory::getInstance();
44  $this->assertEquals($first, $second);
45  }
46 
47  protected function setGlobalVariable(string $name, $value): void
48  {
49  global $DIC;
50 
51  $GLOBALS[$name] = $value;
52  unset($DIC[$name]);
53  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
54  return $value;
55  };
56  }
57 
58  protected function initDependencies(): void
59  {
60  $this->dic = new Container();
61  $GLOBALS['DIC'] = $this->dic;
62  }
63 }
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
setGlobalVariable(string $name, $value)
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:22
Unit tests for class ilADTFactory.