ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilWaitingListTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
23 
29 class ilWaitingListTest extends TestCase
30 {
31  protected $backupGlobals = false;
32 
33  protected Container $dic;
34 
35  protected function setUp(): void
36  {
37  $this->initDependencies();
38  parent::setUp();
39  }
40 
41  public function testConstruction(): void
42  {
43  $obj_id = 0;
44  $some_waiting_list = new class ($obj_id) extends ilWaitingList {
45  };
46  $instance = new $some_waiting_list($obj_id);
47  $this->assertInstanceOf(ilWaitingList::class, $instance);
48  }
49 
50  protected function initDependencies(): void
51  {
52  $this->dic = new Container();
53  $GLOBALS['DIC'] = $this->dic;
54 
55  $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
56  $this->setGlobalVariable('ilAppEventHandler', $this->createMock(ilAppEventHandler::class));
57  }
58 
59  protected function setGlobalVariable(string $name, $value): void
60  {
61  global $DIC;
62 
63  $GLOBALS[$name] = $value;
64  unset($DIC[$name]);
65  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
66  return $value;
67  };
68  }
69 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
global $DIC
Definition: feed.php:28
$GLOBALS["DIC"]
Definition: wac.php:31
setGlobalVariable(string $name, $value)
Unit tests for tree table.