ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ItemNotificationClientHtmlTest.php
Go to the documentation of this file.
1<?php
2
19require_once(__DIR__ . "/../../../../../../vendor/composer/vendor/autoload.php");
20require_once(__DIR__ . "/../../Base.php");
21
25
30{
34 protected $sig_gen;
35
36 protected C\MainControls\MetaBar $metabar;
37
38 public function setUp(): void
39 {
40 $this->sig_gen = new I\SignalGenerator();
41 }
42
43 public function getUIFactory(): NoUIFactory
44 {
45 $factory = new class () extends NoUIFactory {
46 public I\SignalGenerator $sig_gen;
47
48 public function counter(): I\Counter\Factory
49 {
50 return new I\Counter\Factory();
51 }
52 public function button(): I\Button\Factory
53 {
54 return new I\Button\Factory();
55 }
56 public function symbol(): I\Symbol\Factory
57 {
58 return new I\Symbol\Factory(
59 new I\Symbol\Icon\Factory(),
60 new I\Symbol\Glyph\Factory(),
61 new I\Symbol\Avatar\Factory()
62 );
63 }
64 public function item(): I\Item\Factory
65 {
66 return new I\Item\Factory();
67 }
68 public function mainControls(): I\MainControls\Factory
69 {
70 return new I\MainControls\Factory(
71 $this->sig_gen,
72 new I\MainControls\Slate\Factory(
73 $this->sig_gen,
74 new \ILIAS\UI\Implementation\Component\Counter\Factory(),
75 $this->symbol()
76 )
77 );
78 }
79 };
80 $factory->sig_gen = $this->sig_gen;
81
82 return $factory;
83 }
84
85 public function testRenderClientHtml(): void
86 {
87 $f = $this->getUIFactory();
88 $expected_html = file_get_contents(__DIR__ . "/../../Client/Item/Notification/NotificationItemTest.html");
89
90 $icon = $f->symbol()->icon()->standard("name", "aria_label", "small", false);
91
92 $item = $f->item()->notification("item title", $icon)
93 ->withCloseAction("close_action");
94
95 $item2 = $item->withDescription("Existing Description")
96 ->withProperties(["Label 1" => "Property Value 1","Label 2" => "Property Value 2"])
97 ->withAggregateNotifications([$item]);
98 $notification_slate = $f->mainControls()->slate()->notification(
99 "slate title",
100 [$item,$item2]
101 );
102
103 $glyph = $f->symbol()->glyph()->notification()->withCounter($this->getUIFactory()->counter()->novelty(2));
104 $notification_center = $f->mainControls()->slate()->combined("notification center", $glyph)
105 ->withAdditionalEntry($notification_slate);
106
107 $this->metabar = $f->mainControls()->metaBar()->withAdditionalEntry("Test Slate", $notification_center);
108 $rendered_html = $this->getDefaultRenderer()->render($this->metabar);
109
110 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($rendered_html));
111 }
112}
Provides common functionality for UI tests.
Definition: Base.php:337
Checks if the HTML used for the Client tests is rendered as specified.
button(string $caption, string $cmd)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.