ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilGroupEventHandlerTest.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 testConstruct(): void
42  {
43  $listener = new ilGroupAppEventListener();
44  $this->assertTrue($listener instanceof ilGroupAppEventListener);
45  }
46 
47  protected function setGlobalVariable(string $name, $value): void
48  {
49  global $DIC;
50 
51  $GLOBALS[$name] = $value;
52  unset($DIC[$name]);
53  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
54  return $value;
55  };
56  }
57 
58  protected function initDependencies(): void
59  {
60  $this->dic = new Container();
61  $GLOBALS['DIC'] = $this->dic;
62 
63  $logger = $this->getMockBuilder(ilLogger::class)
64  ->disableOriginalConstructor()
65  ->getMock();
66 
67  $logger_factory = $this->getMockBuilder(ilLoggerFactory::class)
68  ->disableOriginalConstructor()
69  ->onlyMethods(['getComponentLogger'])
70  ->getMock();
71  $logger_factory->method('getComponentLogger')->willReturn($logger);
72  $this->setGlobalVariable('ilLoggerFactory', $logger_factory);
73  }
74 }
Unit tests for tree table.
$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