ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
StandardNotificationRendererTest.php
Go to the documentation of this file.
1 <?php
2 
21 
22 require_once(__DIR__ . "/../../BaseNotificationSetUp.php");
23 
28 {
29  use Hasher;
30 
31 
32  protected function setUp(): void
33  {
34  parent::setUp();
35  if (!defined("ILIAS_HTTP_PATH")) {
36  define("ILIAS_HTTP_PATH", "http://localhost");
37  }
38  }
39 
40  public function testConstruct(): void
41  {
42  $renderer = new StandardNotificationRenderer($this->getUIFactory());
43  $this->assertInstanceOf(StandardNotificationRenderer::class, $renderer);
44  }
45 
46 
47  public function testGetNotificationComponentForItem(): void
48  {
49  $renderer = new StandardNotificationRenderer($this->getUIFactory());
50  $icon = $this->getUIFactory()->symbol()->icon()->standard("mail", "mail");
51  $item = $this->getUIFactory()->item()->notification("hello", $icon);
52 
53  $standard_notification = $this->factory->standard($this->id)->withNotificationItem($item);
54 
55  $this->assertEquals($item, $renderer->getNotificationComponentForItem($standard_notification));
56  }
57 
58 
60  {
61  $renderer = new StandardNotificationRenderer($this->getUIFactory());
62  $icon = $this->getUIFactory()->symbol()->icon()->standard("mail", "mail");
63  $item = $this->getUIFactory()->item()->notification("hello", $icon);
64 
65  $standard_notification = $this->factory->standard($this->id)
66  ->withNotificationItem($item)
67  ->withClosedCallable(function (): void {
68  });
69 
70  $item = $item->withCloseAction("src/GlobalScreen/Client/notify.php?mode=closed&item_id=" . $this->hash($this->id->serialize()));
71  $this->assertEquals($item, $renderer->getNotificationComponentForItem($standard_notification));
72  }
73 }
Class BaseNotificationSetUp.