ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilExportOptionsTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use PHPUnit\Framework\TestCase;
23
28class ilExportOptionsTest 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 {
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}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Class ilExportOptionsTest.
setGlobalVariable(string $name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static newInstance(int $a_export_id)
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54