ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWaitingListTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
23
29class 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}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Unit tests for tree table.
setGlobalVariable(string $name, $value)
Base class for course and group waiting lists.
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54