ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExportOptionsTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
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  $options = ilExportOptions::getInstance();
43  $this->assertNull($options);
44 
45  $options = ilExportOptions::newInstance(0);
46  $this->assertTrue($options instanceof ilExportOptions);
47 
48  $options_ref = ilExportOptions::getInstance();
49  $this->assertEquals($options, $options_ref);
50  }
51 
52 
53  protected function setGlobalVariable(string $name, $value): void
54  {
55  global $DIC;
56 
57  $GLOBALS[$name] = $value;
58  unset($DIC[$name]);
59  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
60  return $value;
61  };
62  }
63 
64  protected function initDependencies(): void
65  {
66  $this->dic = new Container();
67  $GLOBALS['DIC'] = $this->dic;
68 
69  $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
70  }
71 }
static newInstance(int $a_export_id)
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:22
Class ilExportOptionsTest.
setGlobalVariable(string $name, $value)