ILIAS  release_8 Revision v8.23
ilECSUserTest.php
Go to the documentation of this file.
1 <?php
2 
18 declare(strict_types=1);
19 
25 
29 class 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 }
$c
Definition: cli.php:38
setGlobalVariable(string $name, $value)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Class ilSessionTest.
$dic
Definition: result.php:32
Stores relevant user data.