ILIAS  release_8 Revision v8.24
ilTrackingCollectionTest.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5use PHPUnit\Framework\TestCase;
7
12class ilTrackingCollectionTest extends TestCase
13{
14 protected Container $dic;
15
16 protected function setUp(): void
17 {
18 parent::setUp();
19 $this->initDependencies();
20 }
21
22 public function testCollectionInstance(): void
23 {
25 0,
27 );
28 $this->assertInstanceOf(
29 ilLPCollectionOfObjectives::class,
31 );
32 }
33
34 protected function setGlobalVariable(string $name, $value): void
35 {
36 global $DIC;
37
38 $GLOBALS[$name] = $value;
39 unset($DIC[$name]);
40 $DIC[$name] = static function (Container $c) use ($value) {
41 return $value;
42 };
43 }
44
45 protected function initDependencies(): void
46 {
47 $this->dic = new Container();
48 $GLOBALS['DIC'] = $this->dic;
49 $this->setGlobalVariable(
50 'ilDB',
51 $this->createMock(ilDBInterface::class)
52 );
53 $logger = $this->getMockBuilder(ilLogger::class)
54 ->disableOriginalConstructor()
55 ->getMock();
56
57 $logger_factory = $this->getMockBuilder(ilLoggerFactory::class)
58 ->disableOriginalConstructor()
59 ->onlyMethods(['getComponentLogger'])
60 ->getMock();
61 $logger_factory->method('getComponentLogger')->willReturn($logger);
62 $this->setGlobalVariable('ilLoggerFactory', $logger_factory);
63 }
64}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
static getInstanceByMode(int $a_obj_id, int $a_mode)
setGlobalVariable(string $name, $value)
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
$objectives