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