ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
MainNotificationCollectorTest Class Reference

Class MainNotificationCollectorTest. More...

+ Inheritance diagram for MainNotificationCollectorTest:
+ Collaboration diagram for MainNotificationCollectorTest:

Public Member Functions

 testConstruct ()
 
 testHasNotifications ()
 
 testGetNotifications ()
 
 testGetAmountOfNewNotifications ()
 
 testGetAmountOfOldNotifications ()
 
 testGetNotificationsIdentifiersAsArray ()
 
- Public Member Functions inherited from BaseNotificationSetUp
 getUIFactory ()
 
 getDIC ()
 
 getDummyNotificationsProviderWithNotifications ($notifications)
 

Additional Inherited Members

- Protected Member Functions inherited from BaseNotificationSetUp
 setUp ()
 
- Protected Attributes inherited from BaseNotificationSetUp
 $id
 
 $provider
 
 $identification
 
 $factory
 

Detailed Description

Member Function Documentation

◆ testConstruct()

MainNotificationCollectorTest::testConstruct ( )

Definition at line 28 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

28  : void
29  {
31  $collector = new MainNotificationCollector([$povider]);
32  $this->assertInstanceOf(MainNotificationCollector::class, $collector);
33  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testGetAmountOfNewNotifications()

MainNotificationCollectorTest::testGetAmountOfNewNotifications ( )

Definition at line 67 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

67  : void
68  {
70  $collector = new MainNotificationCollector([$povider]);
71  $this->assertEquals(0, $collector->getAmountOfNewNotifications());
72 
73  $group_notification = $this->factory->standardGroup($this->id);
74  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
75  $collector = new MainNotificationCollector([$povider]);
76  $this->assertEquals(0, $collector->getAmountOfNewNotifications());
77 
78  $group_notification = $this->factory->standardGroup($this->id);
79  $standard_notification = $this->factory->standard($this->id)->withNewAmount(3);
80  $group_notification->addNotification($standard_notification);
81  $group_notification->addNotification($standard_notification);
82 
83  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification, $group_notification]);
84  $collector = new MainNotificationCollector([$povider]);
85  $this->assertEquals(4, $collector->getAmountOfNewNotifications());
86  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testGetAmountOfOldNotifications()

MainNotificationCollectorTest::testGetAmountOfOldNotifications ( )

Definition at line 89 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

89  : void
90  {
92  $collector = new MainNotificationCollector([$povider]);
93  $this->assertEquals(0, $collector->getAmountOfOldNotifications());
94 
95  $group_notification = $this->factory->standardGroup($this->id);
96  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
97  $collector = new MainNotificationCollector([$povider]);
98  $this->assertEquals(0, $collector->getAmountOfOldNotifications());
99 
100  $group_notification = $this->factory->standardGroup($this->id);
101  $standard_notification = $this->factory->standard($this->id)->withOldAmount(3);
102  $group_notification->addNotification($standard_notification);
103  $group_notification->addNotification($standard_notification);
104 
105  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification, $group_notification]);
106  $collector = new MainNotificationCollector([$povider]);
107  $this->assertEquals(4, $collector->getAmountOfOldNotifications());
108  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testGetNotifications()

MainNotificationCollectorTest::testGetNotifications ( )

Definition at line 49 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

49  : void
50  {
52  $collector = new MainNotificationCollector([$povider]);
53  $this->assertEquals([], $collector->getNotifications());
54 
55  $group_notification = $this->factory->standardGroup($this->id);
56  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
57  $collector = new MainNotificationCollector([$povider]);
58  $this->assertEquals([$group_notification], $collector->getNotifications());
59 
60  $group_notification = $this->factory->standardGroup($this->id);
61  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification, $group_notification]);
62  $collector = new MainNotificationCollector([$povider]);
63  $this->assertEquals([$group_notification, $group_notification], $collector->getNotifications());
64  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testGetNotificationsIdentifiersAsArray()

MainNotificationCollectorTest::testGetNotificationsIdentifiersAsArray ( )

Definition at line 111 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\$provider, BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications(), and ILIAS\GlobalScreen\Provider\id().

111  : void
112  {
114  $collector = new MainNotificationCollector([$provider]);
115 
116  $this->assertEquals([], $collector->getNotificationsIdentifiersAsArray());
117 
118  $group_notification = $this->factory->standardGroup($this->id);
119  $provider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
120  $collector = new MainNotificationCollector([$provider]);
121 
122  $this->assertEquals([$this->id->serialize()], $collector->getNotificationsIdentifiersAsArray());
123 
124  $group_notification = $this->factory->standardGroup($this->id);
125  $provider = $this->getDummyNotificationsProviderWithNotifications([$group_notification, $group_notification]);
126  $collector = new MainNotificationCollector([$provider]);
127 
128  $this->assertEquals([$this->id->serialize(), $this->id->serialize()], $collector->getNotificationsIdentifiersAsArray());
129  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testHasNotifications()

MainNotificationCollectorTest::testHasNotifications ( )

Definition at line 36 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

36  : void
37  {
39  $collector = new MainNotificationCollector([$povider]);
40  $this->assertFalse($collector->hasItems());
41 
42  $group_notification = $this->factory->standardGroup($this->id);
43  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
44  $collector = new MainNotificationCollector([$povider]);
45  $this->assertTrue($collector->hasItems());
46  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: