ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilModulesOrgUnitPermissionTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  public function testOrgUnitPermissionConstruction(): void
26  {
27  $permission = new ilOrgUnitPermission();
28  $this->assertInstanceOf(ilOrgUnitPermission::class, $permission);
29  $this->assertEquals(0, $permission->getId());
30  $this->assertEquals(ilOrgUnitPermission::PARENT_TEMPLATE, $permission->getParentId());
31  $this->assertEquals(0, $permission->getContextId());
32  $this->assertEquals(0, $permission->getPositionId());
33  $this->assertEquals([], $permission->getOperations());
34  $this->assertEquals([], $permission->getPossibleOperations());
35  $this->assertEquals([], $permission->getSelectedOperationIds());
36  $this->assertEquals(null, $permission->getContext());
37  $this->assertEquals(false, $permission->isProtected());
38  $this->assertEquals(true, $permission->isTemplate());
39  $this->assertEquals(false, $permission->isOperationIdSelected(1));
40  }
41 
42  public function testOrgUnitPermissionModification(): void
43  {
44  $mock_operation = $this->createMock(ilOrgUnitOperation::class);
45  $mock_context = $this->createMock(ilOrgUnitOperationContext::class);
46 
47  $permission = new ilOrgUnitPermission(666);
48  $this->assertEquals(666, $permission->getId());
49  $this->assertEquals(777, $permission->withParentId(777)->getParentId());
50  $this->assertEquals(888, $permission->withContextId(888)->getContextId());
51  $this->assertEquals(999, $permission->withPositionId(999)->getPositionId());
52  $this->assertEquals([$mock_operation], $permission->withOperations([$mock_operation])->getOperations());
53  $this->assertEquals([$mock_operation], $permission->withPossibleOperations([$mock_operation])->getPossibleOperations());
54  $this->assertEquals([1,2], $permission->withSelectedOperationIds([1,2])->getSelectedOperationIds());
55  $this->assertEquals($mock_context, $permission->withContext($mock_context)->getContext());
56  $this->assertEquals(true, $permission->withProtected(true)->isProtected());
57  $this->assertEquals(false, $permission->withParentId(777)->isTemplate());
58  $this->assertEquals(true, $permission->withSelectedOperationIds([1,2])->isOperationIdSelected(1));
59  }
60 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null