ILIAS  release_8 Revision v8.24
ilRegistrationSettingsTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
23
27class ilRegistrationSettingsTest extends TestCase
28{
29 protected Container $dic;
30
31 protected function setUp(): void
32 {
33 $this->initDependencies();
34 parent::setUp();
35 }
36
37 public function testConstruct(): void
38 {
39 global $DIC;
41 $ilSetting = $DIC['ilSetting'];
42 $ilSetting->method("get")->willReturnCallback(
43 function ($arg, $arg2 = null) {
44 if ($arg === 'approve_recipient' && $arg2=== "") {
45 return "";
46 }
47 return null;
48 }
49 );
50
52 $this->assertInstanceOf(ilRegistrationSettings::class, $settings);
53 }
54
55 protected function setGlobalVariable(string $name, $value): void
56 {
57 global $DIC;
58
59 $GLOBALS[$name] = $value;
60 unset($DIC[$name]);
61 $DIC[$name] = static function (Container $c) use ($value) {
62 return $value;
63 };
64 }
65
66 protected function initDependencies(): void
67 {
68 $this->dic = new Container();
69 $GLOBALS['DIC'] = $this->dic;
70
71 $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
72 $this->setGlobalVariable('ilSetting', $this->createMock(ilSetting::class));
73 }
74}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
Class ilObjAuthSettingsGUI.
$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
global $ilSetting
Definition: privfeed.php:17