62 : void
63 {
65 $user_mock = $this->createMock(ilObjUser::class);
66 $user_mock->expects($this->atLeast(1))
67 ->method('getId')
68 ->willReturn(42);
69
70 $notification->setPermanent(true);
71 $this->assertTrue($notification->isVisibleForUser($user_mock));
72
73 $notification->setPermanent(false);
74
75 $notification->setDisplayStart(new DateTimeImmutable("-2 hours"));
76 $notification->setEventStart(new DateTimeImmutable("-1 hours"));
77 $notification->setDisplayEnd(new DateTimeImmutable("+2 hours"));
78 $notification->setEventEnd(new DateTimeImmutable("+1 hours"));
79 $this->assertTrue($notification->isVisibleForUser($user_mock));
80
81 $notification->setDisplayStart(new DateTimeImmutable("+1 hours"));
82 $notification->setEventStart(new DateTimeImmutable("+2 hours"));
83 $notification->setDisplayEnd(new DateTimeImmutable("+4 hours"));
84 $notification->setEventEnd(new DateTimeImmutable("+3 hours"));
85 $this->assertFalse($notification->isVisibleForUser($user_mock));
86 }