ILIAS  release_8 Revision v8.24
ilECSUserTest.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
23use PHPUnit\Framework\MockObject\MockObject;
24use PHPUnit\Framework\TestCase;
25
29class ilECSUserTest extends TestCase
30{
31 protected function setUp(): void
32 {
33 $this->dic = new Container();
34 $GLOBALS['DIC'] = $this->dic;
35
36 $this->setGlobalVariable(
37 'ilSetting',
38 $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->getMock()
39 );
40
41 parent::setUp();
42 }
43
48 protected function setGlobalVariable(string $name, $value): void
49 {
50 global $DIC;
51
52 $GLOBALS[$name] = $value;
53
54 unset($DIC[$name]);
55 $DIC[$name] = static function ($c) use ($name) {
56 return $GLOBALS[$name];
57 };
58 }
59
60 public function testConstructorWithArray(): void
61 {
62 $testdata = [];
63 $testdata['ecs_login'] = 'testlogin';
64 $testdata['ecs_firstname'] = 'test_firstname';
65 $testdata['ecs_lastname'] = 'test_lastname';
66
67 $testdata['ecs_institution'] = 'test_institution';
68 $testdata['ecs_email'] = 'test@email.nowhere';
69 $testdata['ecs_uid_hash'] = 'test_hash';
70
71 $user = new ilECSUser($testdata);
72 $this->assertEquals('testlogin', $user->getLogin());
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 ilSessionTest.
setGlobalVariable(string $name, $value)
Stores relevant user data.
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
This is how the factory for UI elements looks.
Definition: Factory.php:38
if($format !==null) $name
Definition: metadata.php:247
$dic
Definition: result.php:32