ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
GroupNotificationTestTBD.php
Go to the documentation of this file.
1<?php
2
21
22require_once(__DIR__ . "/../BaseNotificationSetUp.php");
23
28{
29 public function testConstructByFactory(): void
30 {
31 $group_notification = $this->factory->standardGroup($this->id);
32
33 $this->assertInstanceOf(StandardNotificationGroup::class, $group_notification);
34 $this->assertEquals($this->id, $group_notification->getProviderIdentification());
35 }
36
37 public function testWitTitle(): void
38 {
39 $group_notification = $this->factory->standardGroup($this->id)->withTitle("test");
40 $this->assertEquals("test", $group_notification->getTitle());
41 }
42
43 public function testAddNotification(): void
44 {
45 $group_notification = $this->factory->standardGroup($this->id);
46 $this->assertEquals([], $group_notification->getNotifications());
47 $standard_notification = $this->factory->standard($this->id);
48 $group_notification->addNotification($standard_notification);
49 $this->assertEquals([$standard_notification], $group_notification->getNotifications());
50 $group_notification->addNotification($standard_notification);
51 $this->assertEquals([$standard_notification,$standard_notification], $group_notification->getNotifications());
52 }
53
54 public function testNotificationCount(): void
55 {
56 $group_notification = $this->factory->standardGroup($this->id);
57 $this->assertEquals(0, $group_notification->getNotificationsCount());
58 $standard_notification = $this->factory->standard($this->id);
59 $group_notification->addNotification($standard_notification);
60 $this->assertEquals(1, $group_notification->getNotificationsCount());
61 $group_notification->addNotification($standard_notification);
62 $this->assertEquals(2, $group_notification->getNotificationsCount());
63 }
64
65 public function testNewNotificationCount(): void
66 {
67 $group_notification = $this->factory->standardGroup($this->id);
68 $this->assertEquals(0, $group_notification->getNewNotificationsCount());
69 $standard_notification = $this->factory->standard($this->id)->withNewAmount(3);
70 $group_notification->addNotification($standard_notification);
71 $this->assertEquals(3, $group_notification->getNewNotificationsCount());
72 $group_notification->addNotification($standard_notification);
73 $this->assertEquals(6, $group_notification->getNewNotificationsCount());
74 }
75
76 public function testOldNotificationCount(): void
77 {
78 $group_notification = $this->factory->standardGroup($this->id);
79 $this->assertEquals(0, $group_notification->getOldNotificationsCount());
80 $standard_notification = $this->factory->standard($this->id)->withOldAmount(3);
81 $group_notification->addNotification($standard_notification);
82 $this->assertEquals(3, $group_notification->getOldNotificationsCount());
83 $group_notification->addNotification($standard_notification);
84 $this->assertEquals(6, $group_notification->getOldNotificationsCount());
85 }
86
90 public function testGetProviderIdentification(): void
91 {
92 $standard_notification = $this->factory->standard($this->id);
93 $this->assertEquals($this->id, $standard_notification->getProviderIdentification());
94 }
95
96 public function testGetRenderer(): void
97 {
98 $group_notification = $this->factory->standardGroup($this->id);
99 $this->assertInstanceOf(
100 StandardNotificationGroupRenderer::class,
101 $group_notification->getRenderer($this->getUIFactory())
102 );
103 }
104
105 public function testWithOpenedCallable(): void
106 {
107 $callable = (fn(): string => "something");
108 $standard_notification = $this->factory->standard($this->id);
109 $this->assertEquals(function (): void {
110 }, $standard_notification->getOpenedCallable());
111 $standard_notification = $standard_notification->withOpenedCallable($callable);
112 $this->assertEquals($callable, $standard_notification->getOpenedCallable());
113 }
114}
factory()
Class BaseNotificationSetUp.
Class StandardNotificationTest.
testGetProviderIdentification()
Tests on AbstractBaseNotification.
Class StandardNotificationGroup Groups a set of Notification.