ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilECSUserTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 
30 class 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 }
setGlobalVariable(string $name, $value)
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:22
Class ilSessionTest.
$dic
Definition: result.php:31
Stores relevant user data.