ILIAS  release_8 Revision v8.24
ilPrivacySettingsTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5use PHPUnit\Framework\TestCase;
7
13class ilPrivacySettingsTest extends TestCase
14{
15 protected ?Container $dic = null;
16
17 protected function setUp(): void
18 {
19 $this->initDependencies();
20 parent::setUp();
21 }
22
23 protected function tearDown(): void
24 {
25 global $DIC;
26
28
29 parent::tearDown();
30 }
31
32 public function testConstruct(): void
33 {
35 $this->assertInstanceOf(ilPrivacySettings::class, $settings);
36 }
37
38 protected function setGlobalVariable(string $name, $value): void
39 {
40 global $DIC;
41
42 $GLOBALS[$name] = $value;
43 unset($DIC[$name]);
44 $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
45 return $value;
46 };
47 }
48
49 protected function initDependencies(): void
50 {
51 global $DIC;
52
53 $this->dic = is_object($DIC) ? clone $DIC : $DIC;
54
55 $DIC = new Container();
56
57 if (!defined('SYSTEM_FOLDER_ID')) {
58 define('SYSTEM_FOLDER_ID', 9);
59 }
60
61 $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
62 $this->setGlobalVariable('ilSetting', $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->getMock());
63 $this->setGlobalVariable('ilUser', $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock());
64 }
65}
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 class ilPrivacySettingsTest.
setGlobalVariable(string $name, $value)
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200