ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
StandardNotificationTest.php
Go to the documentation of this file.
1<?php
4
5require_once(__DIR__ . "/../BaseNotificationSetUp.php");
6
11{
12 public function testConstructByFactory()
13 {
14 $standard_notification = $this->factory->standard($this->id);
15
16 $this->assertInstanceOf(StandardNotification::class, $standard_notification);
17 $this->assertEquals($this->id, $standard_notification->getProviderIdentification());
18 }
19
20 public function testWithNotificationItem()
21 {
22 $icon = $this->getUIFactory()->symbol()->icon()->standard("mail", "mail");
23 $item = $this->getUIFactory()->item()->notification("hello", $icon);
24
25 $standard_notification = $this->factory->standard($this->id)->withNotificationItem($item);
26 $this->assertEquals($item, $standard_notification->getNotificationItem());
27 }
28
29 public function testWithNewAmout()
30 {
31 $standard_notification = $this->factory->standard($this->id);
32
33 $this->assertEquals(1, $standard_notification->getNewAmount());
34 $standard_notification = $standard_notification->withNewAmount(13);
35 $this->assertEquals(13, $standard_notification->getNewAmount());
36 }
37
38 public function testWithOldAmout()
39 {
40 $standard_notification = $this->factory->standard($this->id);
41
42 $this->assertEquals(0, $standard_notification->getOldAmount());
43 $standard_notification = $standard_notification->withOldAmount(13);
44 $this->assertEquals(13, $standard_notification->getOldAmount());
45 }
46
51 {
52 $standard_notification = $this->factory->standard($this->id);
53 $this->assertEquals($this->id, $standard_notification->getProviderIdentification());
54 }
55
56 public function testGetRenderer()
57 {
58 $standard_notification = $this->factory->standard($this->id);
59 $this->assertInstanceOf(
60 StandardNotificationRenderer::class,
61 $standard_notification->getRenderer($this->getUIFactory())
62 );
63 }
64
65 public function testWithOpenedCallable()
66 {
67 $callable = function () {
68 return "something";
69 };
70 $standard_notification = $this->factory->standard($this->id);
71 $this->assertEquals(function () {
72 }, $standard_notification->getOpenedCallable());
73 $standard_notification = $standard_notification->withOpenedCallable($callable);
74 $this->assertEquals($callable, $standard_notification->getOpenedCallable());
75 }
76 public function testWithClosedCallable()
77 {
78 $callable = function () {
79 return "something";
80 };
81 $standard_notification = $this->factory->standard($this->id);
82 $this->assertNull($standard_notification->getClosedCallable());
83 $standard_notification = $standard_notification->withClosedCallable($callable);
84 $this->assertEquals($callable, $standard_notification->getClosedCallable());
85 }
86 public function testHasClosedCallable()
87 {
88 $callable = function () {
89 return "something";
90 };
91 $standard_notification = $this->factory->standard($this->id);
92 $this->assertFalse($standard_notification->hasClosedCallable());
93 $standard_notification = $standard_notification->withClosedCallable($callable);
94 $this->assertTrue($standard_notification->hasClosedCallable());
95 }
96}
Class BaseNotificationSetUp.
An exception for terminatinating execution or to throw for unit testing.
Class StandardNotificationTest.
testGetProviderIdentification()
Tests on AbstractBaseNotification.