3 declare(strict_types=1);
    32     protected function setUp(): void
    35         $this->dic_backup = is_object($DIC) ? clone 
$DIC : 
$DIC;
    38         $DIC[
'ilDB'] = $this->createMock(ilDBInterface::class);
    39         $this->rbacreview_mock = $DIC[
'rbacreview'] = $this->createMock(ilRbacReview::class);
    51         $this->assertEquals(0, $notification->getId());
    53         $notification->setTitle(
'Title');
    54         $notification->setActive(
true);
    58         $this->assertTrue($notification->isActive());
    59         $this->assertFalse($notification->isDuringEvent());
    65         $user_mock = $this->createMock(ilObjUser::class);
    66         $user_mock->expects($this->atLeast(1))
    70         $notification->setPermanent(
true);
    71         $this->assertTrue($notification->isVisibleForUser($user_mock));
    73         $notification->setPermanent(
false);
    79         $this->assertTrue($notification->isVisibleForUser($user_mock));
    85         $this->assertFalse($notification->isVisibleForUser($user_mock));
    91         $user_mock = $this->createMock(ilObjUser::class);
    92         $user_mock->expects($this->atLeast(1))
    96         $notification->setPermanent(
true);
    97         $notification->setLimitToRoles(
true);
    98         $notification->setLimitedToRoleIds([2, 22, 222]);
   100         $this->rbacreview_mock->expects($this->once())
   101                               ->method(
'isAssignedToAtLeastOneGivenRole')
   102                               ->with(42, [2, 22, 222])
   105         $this->assertTrue($notification->isVisibleForUser($user_mock));
   111         $user_mock = $this->createMock(ilObjUser::class);
   112         $user_mock->expects($this->atLeast(1))
   116         $notification->setPermanent(
true);
   117         $notification->setLimitToRoles(
true);
   118         $notification->setLimitedToRoleIds([2, 22, 222]);
   120         $this->rbacreview_mock->expects($this->once())
   121                               ->method(
'isAssignedToAtLeastOneGivenRole')
   122                               ->with(42, [2, 22, 222])
   125         $this->assertFalse($notification->isVisibleForUser($user_mock));
 
ILIAS DI Container $dic_backup
 
Customizing of pimple-DIC for ILIAS. 
 
testVisibilityByRoleNotGranted()