ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods(['get'])->getMock();
40 $settings->method('get')->willReturn('');
41
42 $settings = new ilRegistrationSettings($settings);
43 $this->assertInstanceOf(ilRegistrationSettings::class, $settings);
44 }
45
46 protected function setGlobalVariable(string $name, $value): void
47 {
48 global $DIC;
49
50 $GLOBALS[$name] = $value;
51 unset($DIC[$name]);
52 $DIC[$name] = static function (Container $c) use ($value) {
53 return $value;
54 };
55 }
56
57 protected function initDependencies(): void
58 {
59 $this->dic = new Container();
60 $GLOBALS['DIC'] = $this->dic;
61
62 $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
63 $this->setGlobalVariable('ilSetting', $this->createMock(ilSetting::class));
64 }
65}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Class ilObjAuthSettingsGUI.
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54