ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilWaitingListTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
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 }
Base class for course and group waiting lists.
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
setGlobalVariable(string $name, $value)
global $DIC
Definition: shib_login.php:22
Unit tests for tree table.