ILIAS  release_8 Revision v8.24
ItemNotificationClientHtmlTest.php
Go to the documentation of this file.
1<?php
2
19require_once(__DIR__ . "/../../../../libs/composer/vendor/autoload.php");
20require_once(__DIR__ . "/../../Base.php");
21
25
30{
34 protected $sig_gen;
35
36 public function setUp(): void
37 {
38 $this->sig_gen = new I\SignalGenerator();
39 }
40
41 public function getUIFactory(): NoUIFactory
42 {
43 $factory = new class () extends NoUIFactory {
44 public function counter(): C\Counter\Factory
45 {
46 return new I\Counter\Factory();
47 }
48 public function button(): C\Button\Factory
49 {
50 return new I\Button\Factory($this->sig_gen);
51 }
52 public function symbol(): ILIAS\UI\Component\Symbol\Factory
53 {
54 return new I\Symbol\Factory(
55 new I\Symbol\Icon\Factory(),
56 new I\Symbol\Glyph\Factory(),
57 new I\Symbol\Avatar\Factory()
58 );
59 }
60 public function item(): C\Item\Factory
61 {
62 return new I\Item\Factory();
63 }
64 public function mainControls(): C\MainControls\Factory
65 {
66 return new I\MainControls\Factory(
67 $this->sig_gen,
68 new I\MainControls\Slate\Factory(
69 $this->sig_gen,
70 new \ILIAS\UI\Implementation\Component\Counter\Factory(),
71 $this->symbol()
72 )
73 );
74 }
75 };
76 $factory->sig_gen = $this->sig_gen;
77
78 return $factory;
79 }
80
81 public function testRenderClientHtml(): void
82 {
83 $f = $this->getUIFactory();
84 $expected_html = file_get_contents(__DIR__ . "/../../Client/Item/Notification/NotificationItemTest.html");
85
86 $icon = $f->symbol()->icon()->standard("name", "aria_label", "small", false);
87
88 $item = $f->item()->notification("item title", $icon)
89 ->withCloseAction("close_action");
90
91 $item2 = $item->withDescription("Existing Description")
92 ->withProperties(["Label 1" => "Property Value 1","Label 2" => "Property Value 2"])
93 ->withAggregateNotifications([$item]);
94 $notification_slate = $f->mainControls()->slate()->notification(
95 "slate title",
96 [$item,$item2]
97 );
98
99 $glyph = $f->symbol()->glyph()->notification()->withCounter($this->getUIFactory()->counter()->novelty(2));
100 $notification_center = $f->mainControls()->slate()->combined("notification center", $glyph)
101 ->withAdditionalEntry($notification_slate);
102
103 $this->metabar = $f->mainControls()->metaBar()->withAdditionalEntry("Test Slate", $notification_center);
104 $rendered_html = $this->getDefaultRenderer()->render($this->metabar);
105
106 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($rendered_html));
107 }
108}
Provides common functionality for UI tests.
Definition: Base.php:299
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
Checks if the HTML used for the Client tests is rendered as specified.
$factory
Definition: metadata.php:75
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.