ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTrackingCollectionTest.php
Go to the documentation of this file.
1<?php
2
19use PHPUnit\Framework\TestCase;
21
26class ilTrackingCollectionTest extends TestCase
27{
28 protected Container $dic;
29
30 protected function setUp(): void
31 {
32 parent::setUp();
33 $this->initDependencies();
34 }
35
36 public function testCollectionInstance(): void
37 {
39 0,
41 );
42 $this->assertInstanceOf(
43 ilLPCollectionOfObjectives::class,
45 );
46 }
47
48 protected function setGlobalVariable(string $name, $value): void
49 {
50 global $DIC;
51
52 $GLOBALS[$name] = $value;
53 unset($DIC[$name]);
54 $DIC[$name] = static function (Container $c) use ($value) {
55 return $value;
56 };
57 }
58
59 protected function initDependencies(): void
60 {
61 $this->dic = new Container();
62 $GLOBALS['DIC'] = $this->dic;
63 $this->setGlobalVariable(
64 'ilDB',
65 $this->createMock(ilDBInterface::class)
66 );
67 $logger = $this->getMockBuilder(ilLogger::class)
68 ->disableOriginalConstructor()
69 ->getMock();
70
71 $logger_factory = $this->getMockBuilder(ilLoggerFactory::class)
72 ->disableOriginalConstructor()
73 ->onlyMethods(['getComponentLogger'])
74 ->getMock();
75 $logger_factory->method('getComponentLogger')->willReturn($logger);
76 $this->setGlobalVariable('ilLoggerFactory', $logger_factory);
77 }
78}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
static getInstanceByMode(int $a_obj_id, int $a_mode)
setGlobalVariable(string $name, $value)
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$objectives
$GLOBALS["DIC"]
Definition: wac.php:54