ILIAS  release_8 Revision v8.19
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 12 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

12  : void
13  {
15  $collector = new MainNotificationCollector([$povider]);
16  $this->assertInstanceOf(MainNotificationCollector::class, $collector);
17  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testGetAmountOfNewNotifications()

MainNotificationCollectorTest::testGetAmountOfNewNotifications ( )

Definition at line 51 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

51  : void
52  {
54  $collector = new MainNotificationCollector([$povider]);
55  $this->assertEquals(0, $collector->getAmountOfNewNotifications());
56 
57  $group_notification = $this->factory->standardGroup($this->id);
58  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
59  $collector = new MainNotificationCollector([$povider]);
60  $this->assertEquals(0, $collector->getAmountOfNewNotifications());
61 
62  $group_notification = $this->factory->standardGroup($this->id);
63  $standard_notification = $this->factory->standard($this->id)->withNewAmount(3);
64  $group_notification->addNotification($standard_notification);
65  $group_notification->addNotification($standard_notification);
66 
67  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification, $group_notification]);
68  $collector = new MainNotificationCollector([$povider]);
69  $this->assertEquals(4, $collector->getAmountOfNewNotifications());
70  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testGetAmountOfOldNotifications()

MainNotificationCollectorTest::testGetAmountOfOldNotifications ( )

Definition at line 73 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

73  : void
74  {
76  $collector = new MainNotificationCollector([$povider]);
77  $this->assertEquals(0, $collector->getAmountOfOldNotifications());
78 
79  $group_notification = $this->factory->standardGroup($this->id);
80  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
81  $collector = new MainNotificationCollector([$povider]);
82  $this->assertEquals(0, $collector->getAmountOfOldNotifications());
83 
84  $group_notification = $this->factory->standardGroup($this->id);
85  $standard_notification = $this->factory->standard($this->id)->withOldAmount(3);
86  $group_notification->addNotification($standard_notification);
87  $group_notification->addNotification($standard_notification);
88 
89  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification, $group_notification]);
90  $collector = new MainNotificationCollector([$povider]);
91  $this->assertEquals(4, $collector->getAmountOfOldNotifications());
92  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testGetNotifications()

MainNotificationCollectorTest::testGetNotifications ( )

Definition at line 33 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

33  : void
34  {
36  $collector = new MainNotificationCollector([$povider]);
37  $this->assertEquals([], $collector->getNotifications());
38 
39  $group_notification = $this->factory->standardGroup($this->id);
40  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
41  $collector = new MainNotificationCollector([$povider]);
42  $this->assertEquals([$group_notification], $collector->getNotifications());
43 
44  $group_notification = $this->factory->standardGroup($this->id);
45  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification, $group_notification]);
46  $collector = new MainNotificationCollector([$povider]);
47  $this->assertEquals([$group_notification, $group_notification], $collector->getNotifications());
48  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testGetNotificationsIdentifiersAsArray()

MainNotificationCollectorTest::testGetNotificationsIdentifiersAsArray ( )

Definition at line 95 of file MainNotificationCollectorTest.php.

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

95  : void
96  {
98  $collector = new MainNotificationCollector([$provider]);
99 
100  $this->assertEquals([], $collector->getNotificationsIdentifiersAsArray());
101 
102  $group_notification = $this->factory->standardGroup($this->id);
103  $provider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
104  $collector = new MainNotificationCollector([$provider]);
105 
106  $this->assertEquals([$this->id->serialize()], $collector->getNotificationsIdentifiersAsArray());
107 
108  $group_notification = $this->factory->standardGroup($this->id);
109  $provider = $this->getDummyNotificationsProviderWithNotifications([$group_notification, $group_notification]);
110  $collector = new MainNotificationCollector([$provider]);
111 
112  $this->assertEquals([$this->id->serialize(), $this->id->serialize()], $collector->getNotificationsIdentifiersAsArray());
113  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

◆ testHasNotifications()

MainNotificationCollectorTest::testHasNotifications ( )

Definition at line 20 of file MainNotificationCollectorTest.php.

References BaseNotificationSetUp\getDummyNotificationsProviderWithNotifications().

20  : void
21  {
23  $collector = new MainNotificationCollector([$povider]);
24  $this->assertFalse($collector->hasItems());
25 
26  $group_notification = $this->factory->standardGroup($this->id);
27  $povider = $this->getDummyNotificationsProviderWithNotifications([$group_notification]);
28  $collector = new MainNotificationCollector([$povider]);
29  $this->assertTrue($collector->hasItems());
30  }
getDummyNotificationsProviderWithNotifications($notifications)
+ Here is the call graph for this function:

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