ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilServicesAuthShibbolethTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
25 {
27 
28  protected function setUp(): void
29  {
30  global $DIC;
31  $this->dic_backup = is_object($DIC) ? clone $DIC : $DIC;
32 
33  $DIC = new Container();
34  $DIC['ilDB'] = $this->createMock(ilDBInterface::class);
35  }
36 
37  protected function tearDown(): void
38  {
39  global $DIC;
40  $DIC = $this->dic_backup;
41  }
42 
43  public function testRuleAssignement(): void
44  {
45  $rule = new ilShibbolethRoleAssignmentRule();
46  $rule->setName('attribute_1');
47  $rule->setValue('value_1');
48 
49  $this->assertTrue($rule->matches(['attribute_1' => 'value_1']));
50  $this->assertFalse($rule->matches(['attribute_2' => 'value_2']));
51  }
52 
53  public function testWildcardRuleAssignement(): void
54  {
55  $rule = new ilShibbolethRoleAssignmentRule();
56  $rule->setName('attribute_1');
57  $rule->setValue('value_*');
58 
59  $this->assertTrue($rule->matches(['attribute_1' => 'value_1']));
60  $this->assertTrue($rule->matches(['attribute_1' => 'value_2']));
61  $this->assertFalse($rule->matches(['attribute_2' => 'value_2']));
62  }
63 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
global $DIC
Definition: shib_login.php:22