ILIAS  release_8 Revision v8.24
ilWaitingListTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
Unit tests for tree table.
setGlobalVariable(string $name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247