ILIAS  release_8 Revision v8.24
ilSystemCheckTaskTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5use PHPUnit\Framework\TestCase;
7
13class ilSystemCheckTaskTest extends TestCase
14{
15 protected Container $dic;
16
17 protected function setUp(): void
18 {
19 parent::setUp();
20 $this->initDependencies();
21 }
22
23 public function testConstruct(): void
24 {
25 $task = new ilSCTask(0);
26 $this->assertInstanceOf(ilSCTask::class, $task);
27 }
28
29 public function testLastUpdate(): void
30 {
31 $this->getMockBuilder(ilDateTime::class)
32 ->disableOriginalConstructor()
33 ->getMock();
34
35 $task = new ilSCTask();
36 $last_update = $task->getLastUpdate();
37 $this->assertInstanceOf(ilDateTime::class, $last_update);
38 }
39
40 protected function setGlobalVariable(string $name, $value): void
41 {
42 global $DIC;
43
44 $GLOBALS[$name] = $value;
45 unset($DIC[$name]);
46 $DIC[$name] = static function (Container $c) use ($value) {
47 return $value;
48 };
49 }
50
51 protected function initDependencies(): void
52 {
53 $this->dic = new Container();
54 $GLOBALS['DIC'] = $this->dic;
55 $this->setGlobalVariable(
56 'ilDB',
57 $this->createMock(ilDBInterface::class)
58 );
59 $logger = $this->getMockBuilder(ilLogger::class)
60 ->disableOriginalConstructor()
61 ->getMock();
62
63 $logger_factory = $this->getMockBuilder(ilLoggerFactory::class)
64 ->disableOriginalConstructor()
65 ->onlyMethods(['getComponentLogger'])
66 ->getMock();
67 $logger_factory->method('getComponentLogger')->willReturn($logger);
68 $this->setGlobalVariable('ilLoggerFactory', $logger_factory);
69 }
70}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Unit tests for class ilDidacticTemplate.
setGlobalVariable(string $name, $value)
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247