ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ItemNotificationTest Class Reference

Test Notification Items. More...

+ Inheritance diagram for ItemNotificationTest:
+ Collaboration diagram for ItemNotificationTest:

Public Member Functions

 setUp ()
 
 getIcon ()
 
 getUIFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetTitle ()
 
 testGetTitleAsLink ()
 
 testWithDescription ()
 
 testWithProperties ()
 
 testWithActions ()
 
 testWithLeadIcon ()
 
 testWithCloseAction ()
 
 testWithAdditionalContent ()
 
 testWithAggregateNotifications ()
 
 testRenderFullyFeatured ()
 

Protected Attributes

I Component SignalGenerator $sig_gen
 

Detailed Description

Test Notification Items.

Definition at line 31 of file ItemNotificationTest.php.

Member Function Documentation

◆ getIcon()

ItemNotificationTest::getIcon ( )

Definition at line 40 of file ItemNotificationTest.php.

41 {
42 return $this->getUIFactory()->symbol()->icon()->standard("name", "aria_label", "small", false);
43 }

References getUIFactory().

Referenced by testRenderFullyFeatured(), testWithActions(), testWithAdditionalContent(), testWithAggregateNotifications(), testWithCloseAction(), testWithDescription(), testWithLeadIcon(), and testWithProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUIFactory()

ItemNotificationTest::getUIFactory ( )

Definition at line 45 of file ItemNotificationTest.php.

46 {
47 $factory = new class () extends NoUIFactory {
48 public I\Component\SignalGenerator $sig_gen;
49
50 public function item(): I\Component\Item\Factory
51 {
52 return new I\Component\Item\Factory();
53 }
54
55 public function Link(): I\Component\Link\Factory
56 {
57 return new I\Component\Link\Factory();
58 }
59
60 public function button(): I\Component\Button\Factory
61 {
62 return new I\Component\Button\Factory();
63 }
64
65 public function symbol(): I\Component\Symbol\Factory
66 {
67 return new I\Component\Symbol\Factory(
68 new I\Component\Symbol\Icon\Factory(),
69 new I\Component\Symbol\Glyph\Factory(),
70 new I\Component\Symbol\Avatar\Factory()
71 );
72 }
73
74 public function mainControls(): I\Component\MainControls\Factory
75 {
76 return new I\Component\MainControls\Factory(
77 $this->sig_gen,
78 new I\Component\MainControls\Slate\Factory(
79 $this->sig_gen,
80 new I\Component\Counter\Factory(),
81 $this->symbol()
82 )
83 );
84 }
85 };
86 $factory->sig_gen = $this->sig_gen;
87 return $factory;
88 }
I Component SignalGenerator $sig_gen
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21

References $sig_gen, ILIAS\Repository\button(), and ILIAS\Repository\symbol().

Referenced by getIcon(), testGetTitle(), testGetTitleAsLink(), testImplementsFactoryInterface(), testRenderFullyFeatured(), testWithActions(), testWithAdditionalContent(), testWithAggregateNotifications(), testWithCloseAction(), testWithDescription(), testWithLeadIcon(), and testWithProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ItemNotificationTest::setUp ( )

Definition at line 35 of file ItemNotificationTest.php.

35 : void
36 {
37 $this->sig_gen = new I\Component\SignalGenerator();
38 }

◆ testGetTitle()

ItemNotificationTest::testGetTitle ( )

Definition at line 97 of file ItemNotificationTest.php.

97 : void
98 {
99 $f = $this->getUIFactory()->item();
100 $c = $f->standard("title");
101
102 $this->assertEquals("title", $c->getTitle());
103 }
$c
Definition: deliver.php:25

References $c, Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testGetTitleAsLink()

ItemNotificationTest::testGetTitleAsLink ( )

Definition at line 105 of file ItemNotificationTest.php.

105 : void
106 {
107 $f = $this->getUIFactory()->item();
108 $title_link = $this->getUIFactory()->link()->standard("TestLink", "");
109 $c = $f->standard($title_link);
110
111 $this->assertEquals($c->getTitle(), $title_link);
112 }

References $c, Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

ItemNotificationTest::testImplementsFactoryInterface ( )

Definition at line 90 of file ItemNotificationTest.php.

90 : void
91 {
92 $f = $this->getUIFactory()->item();
93
94 $this->assertInstanceOf("ILIAS\\UI\\Component\\Item\\Notification", $f->notification("title", $this->getIcon()));
95 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderFullyFeatured()

ItemNotificationTest::testRenderFullyFeatured ( )

Definition at line 188 of file ItemNotificationTest.php.

188 : void
189 {
190 $f = $this->getUIFactory()->item();
191 $r = $this->getDefaultRenderer(new class () implements JavaScriptBinding {
192 public array $on_load_code = array();
193
194 public function createId(): string
195 {
196 return "id";
197 }
198
199 public function addOnLoadCode(string $code): void
200 {
201 $this->on_load_code[] = $code;
202 }
203
204 public function getOnLoadCodeAsync(): string
205 {
206 }
207 });
208
209 $props = array("prop1" => "val1", "prop2" => "val2");
210 $content = new I\Component\Legacy\Content("someContent", $this->sig_gen);
211 $actions = new I\Component\Dropdown\Standard(array(
212 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
213 new I\Component\Button\Shy("GitHub", "https://www.github.com")
214 ));
215 $title_link = $this->getUIFactory()->link()->standard("TestLink", "");
216 $aggregate = $f->notification("title_aggregate", $this->getIcon());
217
218 $c = $f->notification($title_link, $this->getIcon())
219 ->withDescription("description")
220 ->withProperties($props)
221 ->withAdditionalContent($content)
222 ->withAggregateNotifications([$aggregate])
223 ->withCloseAction("closeAction")
224 ->withActions($actions)
225 ;
226
227 $html = $this->brutallyTrimHTML($r->render($c));
228 $expected = <<<EOT
229<div class="il-item-notification-replacement-container">
230 <div class="il-item il-notification-item" id="id">
231 <div class="media">
232 <div class="media-left">
233 <img class="icon name small" src="./assets/images/standard/icon_default.svg" alt="aria_label"/>
234 </div>
235 <div class="media-body">
236 <h4 class="il-item-notification-title">
237 <a href="">TestLink</a>
238 </h4>
239 <button type="button" class="close" aria-label="close" id="id">
240 <span aria-hidden="true">&times;</span>
241 </button>
242 <div class="il-item-description">description</div>
243 <div class="dropdown" id="id">
244 <button class="btn btn-default dropdown-toggle" type="button" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_menu">
245 <span class="caret"></span>
246 </button>
247 <ul id="id_menu" class="dropdown-menu">
248 <li>
249 <button class="btn btn-link" data-action="https://www.ilias.de" id="id">ILIAS</button>
250 </li>
251 <li>
252 <button class="btn btn-link" data-action="https://www.github.com" id="id">GitHub</button>
253 </li>
254 </ul>
255 </div>
256 <div class="il-item-additional-content">someContent</div>
257 <hr class="il-item-divider">
258 <div class="row il-item-properties">
259 <div class="col-sm-12 il-multi-line-cap-3">
260 <span class="il-item-property-name">prop1</span><span class="il-item-property-value">val1</span>
261 </div>
262 <div class="col-sm-12 il-multi-line-cap-3">
263 <span class="il-item-property-name">prop2</span><span class="il-item-property-value">val2</span>
264 </div>
265 </div>
266 <div class="il-aggregate-notifications" data-aggregatedby="id">
267 <div class="il-maincontrols-slate il-maincontrols-slate-notification">
268 <div class="il-maincontrols-slate-notification-title">
269 <button class="btn btn-bulky" data-action="">
270 <span class="glyph" role="img">
271 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
272 </span>
273 <span class="bulky-label">back</span>
274 </button>
275 </div>
276 <div class="il-maincontrols-slate-content">
277 <div class="il-item-notification-replacement-container">
278 <div class="il-item il-notification-item" id="id">
279 <div class="media">
280 <div class="media-left">
281 <img class="icon name small" src="./assets/images/standard/icon_default.svg" alt="aria_label"/>
282 </div>
283 <div class="media-body">
284 <h4 class="il-item-notification-title">title_aggregate</h4>
285 <div class="il-aggregate-notifications" data-aggregatedby="id">
286 <div class="il-maincontrols-slate il-maincontrols-slate-notification">
287 <div class="il-maincontrols-slate-notification-title">
288 <button class="btn btn-bulky" data-action="">
289 <span class="glyph" role="img">
290 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
291 </span>
292 <span class="bulky-label">back</span>
293 </button>
294 </div>
295 <div class="il-maincontrols-slate-content"></div>
296 </div>
297 </div>
298 </div>
299 </div>
300 </div>
301 </div>
302 </div>
303 </div>
304 </div>
305 </div>
306 </div>
307 </div>
308 </div>
309EOT;
310
311 $this->assertEquals($this->brutallyTrimHTML($expected), $html);
312 }
Provides methods to interface with javascript.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References $c, Vendor\Package\$f, ILIAS\UI\examples\Symbol\Glyph\Back\back(), ILIAS\Repository\button(), getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithActions()

ItemNotificationTest::testWithActions ( )

Definition at line 133 of file ItemNotificationTest.php.

133 : void
134 {
135 $f = $this->getUIFactory()->item();
136
137 $actions = new I\Component\Dropdown\Standard(array(
138 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
139 new I\Component\Button\Shy("GitHub", "https://www.github.com")
140 ));
141 $c = $f->notification("title", $this->getIcon())->withActions($actions);
142
143 $this->assertEquals($c->getActions(), $actions);
144 }

References $c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithAdditionalContent()

ItemNotificationTest::testWithAdditionalContent ( )

Definition at line 166 of file ItemNotificationTest.php.

166 : void
167 {
168 $f = $this->getUIFactory()->item();
169
170 $content = new I\Component\Legacy\Content("someContent", $this->sig_gen);
171 $c = $f->notification("title", $this->getIcon())->withAdditionalContent($content);
172
173 $this->assertEquals($c->getAdditionalContent(), $content);
174 }

References $c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithAggregateNotifications()

ItemNotificationTest::testWithAggregateNotifications ( )

Definition at line 176 of file ItemNotificationTest.php.

176 : void
177 {
178 $f = $this->getUIFactory()->item();
179
180 $aggregate = $f->notification("title_aggregate", $this->getIcon());
181 $c = $f->notification("title", $this->getIcon())
182 ->withAggregateNotifications([$aggregate,$aggregate]);
183
184
185 $this->assertEquals($c->getAggregateNotifications(), [$aggregate,$aggregate]);
186 }

References $c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithCloseAction()

ItemNotificationTest::testWithCloseAction ( )

Definition at line 157 of file ItemNotificationTest.php.

157 : void
158 {
159 $f = $this->getUIFactory()->item();
160
161 $c = $f->notification("title", $this->getIcon())->withCloseAction("closeAction");
162
163 $this->assertEquals("closeAction", $c->getCloseAction());
164 }

References $c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithDescription()

ItemNotificationTest::testWithDescription ( )

Definition at line 114 of file ItemNotificationTest.php.

114 : void
115 {
116 $f = $this->getUIFactory()->item();
117
118 $c = $f->notification("title", $this->getIcon())->withDescription("description");
119
120 $this->assertEquals("description", $c->getDescription());
121 }

References $c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithLeadIcon()

ItemNotificationTest::testWithLeadIcon ( )

Definition at line 146 of file ItemNotificationTest.php.

146 : void
147 {
148 $f = $this->getUIFactory()->item();
149
150 $c = $f->notification("title", $this->getIcon());
151 $this->assertEquals($c->getLeadIcon(), $this->getIcon());
152 $icon2 = $this->getIcon();
153
154 $this->assertEquals($c->withLeadIcon($icon2)->getLeadIcon(), $icon2);
155 }

References $c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithProperties()

ItemNotificationTest::testWithProperties ( )

Definition at line 123 of file ItemNotificationTest.php.

123 : void
124 {
125 $f = $this->getUIFactory()->item();
126
127 $props = array("prop1" => "val1", "prop2" => "val2");
128 $c = $f->notification("title", $this->getIcon())->withProperties($props);
129
130 $this->assertEquals($c->getProperties(), $props);
131 }

References $c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

Field Documentation

◆ $sig_gen

I Component SignalGenerator ItemNotificationTest::$sig_gen
protected

Definition at line 33 of file ItemNotificationTest.php.

Referenced by getUIFactory().


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