ILIAS  release_8 Revision v8.23
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: cli.php:38
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
setGlobalVariable(string $name, $value)
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
Unit tests for class ilADTFactory.