ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilModulesOrgUnitAuthorityTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
22 
24 {
25  public function testOrgUnitAuthorityConstruction(): void
26  {
27  $auth = new ilOrgUnitAuthority();
28  $this->assertInstanceOf(ilOrgUnitAuthority::class, $auth);
29  $this->assertEquals(0, $auth->getId());
30  $this->assertEquals(ilOrgUnitAuthority::OVER_EVERYONE, $auth->getOver());
31  $this->assertEquals(ilOrgUnitAuthority::SCOPE_SAME_ORGU, $auth->getScope());
32  $this->assertEquals(0, $auth->getPositionId());
33  $this->assertEquals('0', (string) $auth);
34  }
35 
36  public function testOrgUnitAuthorityModification(): void
37  {
38  $auth = new ilOrgUnitAuthority(666);
39  $this->assertEquals(666, $auth->getId());
40  $this->assertEquals('666', (string) $auth);
41  $this->assertEquals(555, $auth->withOver(555)->getOver());
42  $this->assertEquals(
44  $auth->withScope(ilOrgUnitAuthority::SCOPE_SUBSEQUENT_ORGUS)->getScope()
45  );
46  $this->assertEquals(333, $auth->withPositionId(333)->getPositionId());
47  }
48 
49  public function testOrgUnitAuthorityInvalidScope(): void
50  {
51  $this->expectException(\ilException::class);
52  $auth = (new ilOrgUnitAuthority())
53  ->withScope(444);
54  }
55 }
Class ilOrguAuthority.