ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilECSUserTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24use PHPUnit\Framework\MockObject\MockObject;
25use PHPUnit\Framework\TestCase;
26
30class ilECSUserTest extends TestCase
31{
32 protected function setUp(): void
33 {
34 $this->dic = new Container();
35 $GLOBALS['DIC'] = $this->dic;
36
37 $this->setGlobalVariable(
38 'ilSetting',
39 $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->getMock()
40 );
41
42 parent::setUp();
43 }
44
49 protected function setGlobalVariable(string $name, $value): void
50 {
51 global $DIC;
52
53 $GLOBALS[$name] = $value;
54
55 unset($DIC[$name]);
56 $DIC[$name] = static function ($c) use ($name) {
57 return $GLOBALS[$name];
58 };
59 }
60
61 public function testConstructorWithArray(): void
62 {
63 $testdata = [];
64 $testdata['ecs_login'] = 'testlogin';
65 $testdata['ecs_firstname'] = 'test_firstname';
66 $testdata['ecs_lastname'] = 'test_lastname';
67
68 $testdata['ecs_institution'] = 'test_institution';
69 $testdata['ecs_email'] = 'test@email.nowhere';
70 $testdata['ecs_uid_hash'] = 'test_hash';
71
72 $user = new ilECSUser($testdata);
73 $this->assertEquals('testlogin', $user->getLogin());
74 }
75}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Class ilSessionTest.
setGlobalVariable(string $name, $value)
Stores relevant user data.
$c
Definition: deliver.php:25
$dic
Definition: ltiresult.php:33
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54